chore: apply more light lints (#2575)

<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->

### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->

### Implementation description
<!-- Explain what you did to correct the problem -->

### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->

### Additional things
<!-- Anything else you would like to say -->
This commit is contained in:
iTrooz
2025-12-20 15:59:48 +01:00
committed by GitHub
parent a1711ccfa6
commit 17c2dfcbd0
54 changed files with 444 additions and 457 deletions

View File

@@ -117,7 +117,7 @@ namespace hex::plugin::builtin {
// Retry analysis with only the first 100 KiB
if (region.getSize() != 100_kiB) {
process(task, provider, { region.getStartAddress(), 100_kiB });
process(task, provider, { .address=region.getStartAddress(), .size=100_kiB });
}
}
}

View File

@@ -134,7 +134,7 @@ namespace hex::plugin::builtin {
if (ImGui::MenuItemEx("hex.builtin.inspector.jump_to_address"_lang, ICON_VS_DEBUG_STEP_OUT)) {
auto address = bufferToInteger<T, Size>(buffer, endian);
if (address >= 0) {
ImHexApi::HexEditor::setSelection(Region { u64(address), sizeof(u8) });
ImHexApi::HexEditor::setSelection(Region { .address=u64(address), .size=sizeof(u8) });
}
}
});
@@ -318,7 +318,7 @@ namespace hex::plugin::builtin {
}
);
ContentRegistry::DataInspector::add("hex.builtin.inspector.fixed_point", 1, [totalBits = int(16), fractionBits = int(8)](const std::vector<u8> &, std::endian endian, Style style) mutable {
ContentRegistry::DataInspector::add("hex.builtin.inspector.fixed_point", 1, [totalBits = 16, fractionBits = 8](const std::vector<u8> &, std::endian endian, Style style) mutable {
std::string value;
auto provider = ImHexApi::Provider::get();

View File

@@ -231,7 +231,7 @@ namespace hex::plugin::builtin {
auto selection = ImHexApi::HexEditor::getSelection()
.value_or(
ImHexApi::HexEditor::ProviderRegion {
{ provider->getBaseAddress(), provider->getSize() },
{ .address=provider->getBaseAddress(), .size=provider->getSize() },
provider
});

View File

@@ -122,7 +122,7 @@ namespace hex::plugin::builtin {
if (!result.has_value()) {
for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getBackgroundHighlights()) {
if (highlighting.getRegion().overlaps({ address, 1 })) {
if (highlighting.getRegion().overlaps({ .address=address, .size=1 })) {
result = highlighting.getColor();
break;
}
@@ -133,7 +133,7 @@ namespace hex::plugin::builtin {
result->Value.w = 1.0F;
} else {
if (auto region = ImHexApi::HexEditor::getSelection(); region.has_value()) {
if (region->overlaps({ address + i, 1 }))
if (region->overlaps({ .address=address + i, .size=1 }))
result = 0x60C08080;
}
}

View File

@@ -27,7 +27,7 @@ namespace hex::plugin::builtin {
auto selection = ImHexApi::HexEditor::getSelection();
return u128(u128(selection->getStartAddress()) << 64 | u128(selection->getSize()));
return (u128(selection->getStartAddress()) << 64 | u128(selection->getSize()));
});
/* add_virtual_file(path, pattern) */

View File

@@ -249,7 +249,7 @@ namespace hex::plugin::builtin {
auto occurrence = searchFunction(reader.begin(), reader.end(), sequence.begin(), sequence.end());
if (occurrence != reader.end()) {
return Region{occurrence.getAddress(), sequence.size()};
return Region{.address=occurrence.getAddress(), .size=sequence.size()};
}
} else {
if (m_reachedEnd || !m_foundRegion.has_value()) {
@@ -261,7 +261,7 @@ namespace hex::plugin::builtin {
auto occurrence = searchFunction(reader.rbegin(), reader.rend(), sequence.rbegin(), sequence.rend());
if (occurrence != reader.rend()) {
return Region{occurrence.getAddress() - (sequence.size() - 1), sequence.size()};
return Region{.address=occurrence.getAddress() - (sequence.size() - 1), .size=sequence.size()};
}
}

View File

@@ -8,7 +8,7 @@
namespace hex::plugin::builtin {
PopupSelect::PopupSelect(u64 address, size_t size) : m_region({address, size}) {}
PopupSelect::PopupSelect(u64 address, size_t size) : m_region({.address=address, .size=size}) {}
void PopupSelect::draw(ViewHexEditor *editor) {
if (ImGui::BeginTabBar("select_tabs")) {
@@ -26,7 +26,7 @@ namespace hex::plugin::builtin {
if (inputB < inputA)
inputB = inputA;
m_region = { inputA, (inputB - inputA) + 1 };
m_region = { .address=inputA, .size=(inputB - inputA) + 1 };
ImGui::EndTabItem();
}
@@ -45,7 +45,7 @@ namespace hex::plugin::builtin {
if (inputB <= 0)
inputB = 1;
m_region = { inputA, inputB };
m_region = { .address=inputA, .size=inputB };
ImGui::EndTabItem();
}

View File

@@ -521,7 +521,7 @@ namespace hex::plugin::builtin {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}

View File

@@ -187,9 +187,9 @@ namespace hex::plugin::builtin {
MenuEntry loadMenuItem;
if (m_loadedIntoMemory)
loadMenuItem = { "hex.builtin.provider.file.menu.direct_access"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToDirectAccess(); } };
loadMenuItem = { .name="hex.builtin.provider.file.menu.direct_access"_lang, .icon=ICON_VS_ARROW_SWAP, .callback=[this] { this->convertToDirectAccess(); } };
else
loadMenuItem = { "hex.builtin.provider.file.menu.into_memory"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToMemoryFile(); } };
loadMenuItem = { .name="hex.builtin.provider.file.menu.into_memory"_lang, .icon=ICON_VS_ARROW_SWAP, .callback=[this] { this->convertToMemoryFile(); } };
return {
{ "hex.builtin.provider.file.menu.open_folder"_lang, ICON_VS_FOLDER_OPENED, [this] { fs::openFolderWithSelectionExternal(m_path); } },
@@ -342,7 +342,7 @@ namespace hex::plugin::builtin {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}

View File

@@ -319,7 +319,7 @@ namespace hex::plugin::builtin {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}

View File

@@ -165,11 +165,11 @@ namespace hex::plugin::builtin {
void IntelHexProvider::setBaseAddress(u64 address) {
auto oldBase = this->getBaseAddress();
auto regions = m_data.overlapping({ oldBase, oldBase + this->getActualSize() });
auto regions = m_data.overlapping({ .start=oldBase, .end=oldBase + this->getActualSize() });
decltype(m_data) newIntervals;
for (auto &[interval, data] : regions) {
newIntervals.insert({ interval.start - oldBase + address, interval.end - oldBase + address }, *data);
newIntervals.insert({ .start=interval.start - oldBase + address, .end=interval.end - oldBase + address }, *data);
}
m_data = newIntervals;
@@ -177,7 +177,7 @@ namespace hex::plugin::builtin {
}
void IntelHexProvider::readRaw(u64 offset, void *buffer, size_t size) {
auto intervals = m_data.overlapping({ offset, (offset + size) - 1 });
auto intervals = m_data.overlapping({ .start=offset, .end=(offset + size) - 1 });
std::memset(buffer, 0x00, size);
auto bytes = static_cast<u8*>(buffer);
@@ -222,7 +222,7 @@ namespace hex::plugin::builtin {
blockSize += bytes.size();
prevAddrEnd = endAddress;
m_data.emplace({ address, endAddress }, std::move(bytes));
m_data.emplace({ .start=address, .end=endAddress }, std::move(bytes));
if (endAddress > maxAddress)
maxAddress = endAddress;
}
@@ -305,18 +305,18 @@ namespace hex::plugin::builtin {
}
std::pair<Region, bool> IntelHexProvider::getRegionValidity(u64 address) const {
auto intervals = m_data.overlapping({ address, address });
auto intervals = m_data.overlapping({ .start=address, .end=address });
if (intervals.empty()) {
return { Region(address, 1), false };
}
decltype(m_data)::Interval closestInterval = { 0, 0 };
decltype(m_data)::Interval closestInterval = { .start=0, .end=0 };
for (const auto &[interval, data] : intervals) {
if (interval.start <= closestInterval.end)
closestInterval = interval;
}
return { Region { closestInterval.start, (closestInterval.end - closestInterval.start) + 1}, Provider::getRegionValidity(address).second };
return { Region { .address=closestInterval.start, .size=(closestInterval.end - closestInterval.start) + 1}, Provider::getRegionValidity(address).second };
}
bool IntelHexProvider::memoryRegionFilter(const std::string& search, const MemoryRegion& memoryRegion) {

View File

@@ -80,7 +80,7 @@ namespace hex::plugin::builtin {
std::vector<MemoryFileProvider::MenuEntry> MemoryFileProvider::getMenuEntries() {
return {
MenuEntry { Lang("hex.builtin.provider.mem_file.rename"), ICON_VS_TAG, [this] { this->renameFile(); } }
MenuEntry { .name=Lang("hex.builtin.provider.mem_file.rename"), .icon=ICON_VS_TAG, .callback=[this] { this->renameFile(); } }
};
}
@@ -88,7 +88,7 @@ namespace hex::plugin::builtin {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}

View File

@@ -187,7 +187,7 @@ namespace hex::plugin::builtin {
std::pair<Region, bool> ProcessMemoryProvider::getRegionValidity(u64 address) const {
for (const auto &memoryRegion : m_memoryRegions) {
if (memoryRegion.region.overlaps({ address, 1LLU }))
if (memoryRegion.region.overlaps({ .address=address, .size=1LLU }))
return { memoryRegion.region, true };
}
@@ -195,7 +195,7 @@ namespace hex::plugin::builtin {
for (const auto &memoryRegion : m_memoryRegions) {
if (address < memoryRegion.region.getStartAddress())
return { Region { lastRegion.getEndAddress(), memoryRegion.region.getStartAddress() - lastRegion.getEndAddress() }, false };
return { Region { .address=lastRegion.getEndAddress(), .size=memoryRegion.region.getStartAddress() - lastRegion.getEndAddress() }, false };
lastRegion = memoryRegion.region;
}
@@ -561,7 +561,7 @@ namespace hex::plugin::builtin {
if (split.size() > 5)
name = wolv::util::trim(wolv::util::combineStrings(std::vector(split.begin() + 5, split.end()), " "));
m_memoryRegions.insert({ { start, end - start }, name });
m_memoryRegions.insert({ { .address=start, .size=end - start }, name });
}
#endif
}

View File

@@ -182,14 +182,14 @@ namespace hex::plugin::builtin {
address -= this->getBaseAddress();
if (address < this->getActualSize())
return { Region { this->getBaseAddress() + address, this->getActualSize() - address }, true };
return { Region { .address=this->getBaseAddress() + address, .size=this->getActualSize() - address }, true };
else
return { Region::Invalid(), false };
}
std::vector<prv::IProviderMenuItems::MenuEntry> ViewProvider::getMenuEntries() {
return {
MenuEntry { Lang("hex.builtin.provider.rename"), ICON_VS_TAG, [this] { this->renameFile(); } }
MenuEntry { .name=Lang("hex.builtin.provider.rename"), .icon=ICON_VS_TAG, .callback=[this] { this->renameFile(); } }
};
}

View File

@@ -865,7 +865,7 @@ namespace hex::plugin::builtin {
}
}
return nameSpace != "";
return !nameSpace.empty();
}
//The context is the name of the function or UDT that the variable is in.

View File

@@ -284,55 +284,55 @@ namespace hex::plugin::builtin {
{
auto &style = ImGui::GetStyle();
const static ThemeManager::StyleMap ImGuiStyleMap = {
{ "alpha", { &style.Alpha, 0.1F, 1.0F, false } },
{ "disabled-alpha", { &style.DisabledAlpha, 0.0F, 1.0F, false } },
{ "window-padding", { &style.WindowPadding, 0.0F, 20.0F, true } },
{ "window-rounding", { &style.WindowRounding, 0.0F, 12.0F, true } },
{ "window-border-size", { &style.WindowBorderSize, 0.0F, 1.0F, true } },
{ "window-border-hover-padding", { &style.WindowBorderHoverPadding, 1.0F, 20.0F, true } },
{ "window-min-size", { &style.WindowMinSize, 0.0F, 1000.0F, true } },
{ "window-title-align", { &style.WindowTitleAlign, 0.0F, 1.0F, false } },
{ "child-rounding", { &style.ChildRounding, 0.0F, 12.0F, true } },
{ "child-border-size", { &style.ChildBorderSize, 0.0F, 1.0F, true } },
{ "popup-rounding", { &style.PopupRounding, 0.0F, 12.0F, true } },
{ "popup-border-size", { &style.PopupBorderSize, 0.0F, 1.0F, true } },
{ "frame-padding", { &style.FramePadding, 0.0F, 20.0F, true } },
{ "frame-rounding", { &style.FrameRounding, 0.0F, 12.0F, true } },
{ "frame-border-size", { &style.FrameBorderSize, 0.0F, 1.0F, true } },
{ "item-spacing", { &style.ItemSpacing, 0.0F, 20.0F, true } },
{ "item-inner-spacing", { &style.ItemInnerSpacing, 0.0F, 20.0F, true } },
{ "indent-spacing", { &style.IndentSpacing, 0.0F, 30.0F, true } },
{ "cell-padding", { &style.CellPadding, 0.0F, 20.0F, true } },
{ "touch-extra-padding", { &style.TouchExtraPadding, 0.0F, 10.0F, true } },
{ "columns-min-spacing", { &style.ColumnsMinSpacing, 0.0F, 20.0F, true } },
{ "scrollbar-size", { &style.ScrollbarSize, 0.0F, 20.0F, true } },
{ "scrollbar-rounding", { &style.ScrollbarRounding, 0.0F, 12.0F, true } },
{ "grab-min-size", { &style.GrabMinSize, 0.0F, 20.0F, true } },
{ "grab-rounding", { &style.GrabRounding, 0.0F, 12.0F, true } },
{ "log-slider-deadzone", { &style.LogSliderDeadzone, 0.0F, 12.0F, true } },
{ "image-border-size", { &style.ImageBorderSize, 0.0F, 1.0F, true } },
{ "tab-rounding", { &style.TabRounding, 0.0F, 12.0F, true } },
{ "tab-border-size", { &style.TabBorderSize, 0.0F, 1.0F, true } },
{ "tab-min-width-base", { &style.TabMinWidthBase, 0.0F, 500.0F, true } },
{ "tab-min-width-shrink", { &style.TabMinWidthShrink, 0.0F, 500.0F, true } },
{ "tab-close-button-min-width-selected", { &style.TabCloseButtonMinWidthSelected, -1.0F, 100.0F, false } },
{ "tab-close-button-min-width-unselected", { &style.TabCloseButtonMinWidthUnselected, -1.0F, 100.0F, false } },
{ "tab-bar-border-size", { &style.TabBarBorderSize, 0.0F, 10.0F, true } },
{ "tab-bar-overline-size", { &style.TabBarOverlineSize, 0.0F, 10.0F, true } },
{ "button-text-align", { &style.ButtonTextAlign, 0.0F, 1.0F, false } },
{ "selectable-text-align", { &style.SelectableTextAlign, 0.0F, 1.0F, false } },
{ "separator-text-border-size", { &style.SeparatorTextBorderSize, 0.0F, 5.0F, true } },
{ "separator-text-align", { &style.SeparatorTextAlign, 0.0F, 1.0F, false } },
{ "separator-text-padding", { &style.SeparatorTextPadding, 0.0F, 20.0F, true } },
{ "display-window-padding", { &style.DisplayWindowPadding, 0.0F, 20.0F, true } },
{ "display-safe-area-padding", { &style.DisplaySafeAreaPadding, 0.0F, 20.0F, true } },
{ "docking-separator-size", { &style.DockingSeparatorSize, 0.0F, 20.0F, true } },
{ "mouse-cursor-scale", { &style.MouseCursorScale, 0.1F, 10.0F, true } },
{ "curve-tessellation-tol", { &style.CurveTessellationTol, 0.0F, 10.0F, true } },
{ "circle-tessellation-max-error", { &style.CircleTessellationMaxError, 0.0F, 10.0F, true } },
{ "window-shadow-size", { &style.WindowShadowSize, 0.0F, 100.0F, true } },
{ "window-shadow-offset", { &style.WindowShadowOffsetDist, 0.0F, 100.0F, true } },
{ "window-shadow-angle", { &style.WindowShadowOffsetAngle, 0.0F, 10.0F, false } }
{ "alpha", { .value=&style.Alpha, .min=0.1F, .max=1.0F, .needsScaling=false } },
{ "disabled-alpha", { .value=&style.DisabledAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "window-padding", { .value=&style.WindowPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "window-rounding", { .value=&style.WindowRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "window-border-size", { .value=&style.WindowBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "window-border-hover-padding", { .value=&style.WindowBorderHoverPadding, .min=1.0F, .max=20.0F, .needsScaling=true } },
{ "window-min-size", { .value=&style.WindowMinSize, .min=0.0F, .max=1000.0F, .needsScaling=true } },
{ "window-title-align", { .value=&style.WindowTitleAlign, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "child-rounding", { .value=&style.ChildRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "child-border-size", { .value=&style.ChildBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "popup-rounding", { .value=&style.PopupRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "popup-border-size", { .value=&style.PopupBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "frame-padding", { .value=&style.FramePadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "frame-rounding", { .value=&style.FrameRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "frame-border-size", { .value=&style.FrameBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "item-spacing", { .value=&style.ItemSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "item-inner-spacing", { .value=&style.ItemInnerSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "indent-spacing", { .value=&style.IndentSpacing, .min=0.0F, .max=30.0F, .needsScaling=true } },
{ "cell-padding", { .value=&style.CellPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "touch-extra-padding", { .value=&style.TouchExtraPadding, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "columns-min-spacing", { .value=&style.ColumnsMinSpacing, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "scrollbar-size", { .value=&style.ScrollbarSize, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "scrollbar-rounding", { .value=&style.ScrollbarRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "grab-min-size", { .value=&style.GrabMinSize, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "grab-rounding", { .value=&style.GrabRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "log-slider-deadzone", { .value=&style.LogSliderDeadzone, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "image-border-size", { .value=&style.ImageBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "tab-rounding", { .value=&style.TabRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "tab-border-size", { .value=&style.TabBorderSize, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "tab-min-width-base", { .value=&style.TabMinWidthBase, .min=0.0F, .max=500.0F, .needsScaling=true } },
{ "tab-min-width-shrink", { .value=&style.TabMinWidthShrink, .min=0.0F, .max=500.0F, .needsScaling=true } },
{ "tab-close-button-min-width-selected", { .value=&style.TabCloseButtonMinWidthSelected, .min=-1.0F, .max=100.0F, .needsScaling=false } },
{ "tab-close-button-min-width-unselected", { .value=&style.TabCloseButtonMinWidthUnselected, .min=-1.0F, .max=100.0F, .needsScaling=false } },
{ "tab-bar-border-size", { .value=&style.TabBarBorderSize, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "tab-bar-overline-size", { .value=&style.TabBarOverlineSize, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "button-text-align", { .value=&style.ButtonTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "selectable-text-align", { .value=&style.SelectableTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "separator-text-border-size", { .value=&style.SeparatorTextBorderSize, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "separator-text-align", { .value=&style.SeparatorTextAlign, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "separator-text-padding", { .value=&style.SeparatorTextPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "display-window-padding", { .value=&style.DisplayWindowPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "display-safe-area-padding", { .value=&style.DisplaySafeAreaPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "docking-separator-size", { .value=&style.DockingSeparatorSize, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "mouse-cursor-scale", { .value=&style.MouseCursorScale, .min=0.1F, .max=10.0F, .needsScaling=true } },
{ "curve-tessellation-tol", { .value=&style.CurveTessellationTol, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "circle-tessellation-max-error", { .value=&style.CircleTessellationMaxError, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "window-shadow-size", { .value=&style.WindowShadowSize, .min=0.0F, .max=100.0F, .needsScaling=true } },
{ "window-shadow-offset", { .value=&style.WindowShadowOffsetDist, .min=0.0F, .max=100.0F, .needsScaling=true } },
{ "window-shadow-angle", { .value=&style.WindowShadowOffsetAngle, .min=0.0F, .max=10.0F, .needsScaling=false } }
};
ThemeManager::addStyleHandler("imgui", ImGuiStyleMap);
@@ -341,32 +341,32 @@ namespace hex::plugin::builtin {
{
auto &style = ImPlot::GetStyle();
const static ThemeManager::StyleMap ImPlotStyleMap = {
{ "line-weight", { &style.LineWeight, 0.0F, 5.0F, true } },
{ "marker-size", { &style.MarkerSize, 2.0F, 10.0F, true } },
{ "marker-weight", { &style.MarkerWeight, 0.0F, 5.0F, true } },
{ "fill-alpha", { &style.FillAlpha, 0.0F, 1.0F, false } },
{ "error-bar-size", { &style.ErrorBarSize, 0.0F, 10.0F, true } },
{ "error-bar-weight", { &style.ErrorBarWeight, 0.0F, 5.0F, true } },
{ "digital-bit-height", { &style.DigitalBitHeight, 0.0F, 20.0F, true } },
{ "digital-bit-gap", { &style.DigitalBitGap, 0.0F, 20.0F, true } },
{ "plot-border-size", { &style.PlotBorderSize, 0.0F, 2.0F, true } },
{ "minor-alpha", { &style.MinorAlpha, 0.0F, 1.0F, false } },
{ "major-tick-len", { &style.MajorTickLen, 0.0F, 20.0F, true } },
{ "minor-tick-len", { &style.MinorTickLen, 0.0F, 20.0F, true } },
{ "major-tick-size", { &style.MajorTickSize, 0.0F, 2.0F, true } },
{ "minor-tick-size", { &style.MinorTickSize, 0.0F, 2.0F, true } },
{ "major-grid-size", { &style.MajorGridSize, 0.0F, 2.0F, true } },
{ "minor-grid-size", { &style.MinorGridSize, 0.0F, 2.0F, true } },
{ "plot-padding", { &style.PlotPadding, 0.0F, 20.0F, true } },
{ "label-padding", { &style.LabelPadding, 0.0F, 20.0F, true } },
{ "legend-padding", { &style.LegendPadding, 0.0F, 20.0F, true } },
{ "legend-inner-padding", { &style.LegendInnerPadding, 0.0F, 10.0F, true } },
{ "legend-spacing", { &style.LegendSpacing, 0.0F, 5.0F, true } },
{ "mouse-pos-padding", { &style.MousePosPadding, 0.0F, 20.0F, true } },
{ "annotation-padding", { &style.AnnotationPadding, 0.0F, 5.0F, true } },
{ "fit-padding", { &style.FitPadding, 0.0F, 0.2F, true } },
{ "plot-default-size", { &style.PlotDefaultSize, 0.0F, 1000.0F, true } },
{ "plot-min-size", { &style.PlotMinSize, 0.0F, 300.0F, true } },
{ "line-weight", { .value=&style.LineWeight, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "marker-size", { .value=&style.MarkerSize, .min=2.0F, .max=10.0F, .needsScaling=true } },
{ "marker-weight", { .value=&style.MarkerWeight, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "fill-alpha", { .value=&style.FillAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "error-bar-size", { .value=&style.ErrorBarSize, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "error-bar-weight", { .value=&style.ErrorBarWeight, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "digital-bit-height", { .value=&style.DigitalBitHeight, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "digital-bit-gap", { .value=&style.DigitalBitGap, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "plot-border-size", { .value=&style.PlotBorderSize, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "minor-alpha", { .value=&style.MinorAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } },
{ "major-tick-len", { .value=&style.MajorTickLen, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "minor-tick-len", { .value=&style.MinorTickLen, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "major-tick-size", { .value=&style.MajorTickSize, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "minor-tick-size", { .value=&style.MinorTickSize, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "major-grid-size", { .value=&style.MajorGridSize, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "minor-grid-size", { .value=&style.MinorGridSize, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "plot-padding", { .value=&style.PlotPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "label-padding", { .value=&style.LabelPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "legend-padding", { .value=&style.LegendPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "legend-inner-padding", { .value=&style.LegendInnerPadding, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "legend-spacing", { .value=&style.LegendSpacing, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "mouse-pos-padding", { .value=&style.MousePosPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "annotation-padding", { .value=&style.AnnotationPadding, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "fit-padding", { .value=&style.FitPadding, .min=0.0F, .max=0.2F, .needsScaling=true } },
{ "plot-default-size", { .value=&style.PlotDefaultSize, .min=0.0F, .max=1000.0F, .needsScaling=true } },
{ "plot-min-size", { .value=&style.PlotMinSize, .min=0.0F, .max=300.0F, .needsScaling=true } },
};
ThemeManager::addStyleHandler("implot", ImPlotStyleMap);
@@ -375,21 +375,21 @@ namespace hex::plugin::builtin {
{
auto &style = ImNodes::GetStyle();
const static ThemeManager::StyleMap ImNodesStyleMap = {
{ "grid-spacing", { &style.GridSpacing, 0.0F, 100.0F, true } },
{ "node-corner-rounding", { &style.NodeCornerRounding, 0.0F, 12.0F, true } },
{ "node-padding", { &style.NodePadding, 0.0F, 20.0F, true } },
{ "node-border-thickness", { &style.NodeBorderThickness, 0.0F, 1.0F, true } },
{ "link-thickness", { &style.LinkThickness, 0.0F, 10.0F, true } },
{ "link-line-segments-per-length", { &style.LinkLineSegmentsPerLength, 0.0F, 2.0F, true } },
{ "link-hover-distance", { &style.LinkHoverDistance, 0.0F, 20.0F, true } },
{ "pin-circle-radius", { &style.PinCircleRadius, 0.0F, 20.0F, true } },
{ "pin-quad-side-length", { &style.PinQuadSideLength, 0.0F, 20.0F, true } },
{ "pin-triangle-side-length", { &style.PinTriangleSideLength, 0.0F, 20.0F, true } },
{ "pin-line-thickness", { &style.PinLineThickness, 0.0F, 5.0F, true } },
{ "pin-hover-radius", { &style.PinHoverRadius, 0.0F, 20.0F, true } },
{ "pin-offset", { &style.PinOffset, -10.0F, 10.0F, true } },
{ "mini-map-padding", { &style.MiniMapPadding, 0.0F, 20.0F, true } },
{ "mini-map-offset", { &style.MiniMapOffset, -10.0F, 10.0F, true } },
{ "grid-spacing", { .value=&style.GridSpacing, .min=0.0F, .max=100.0F, .needsScaling=true } },
{ "node-corner-rounding", { .value=&style.NodeCornerRounding, .min=0.0F, .max=12.0F, .needsScaling=true } },
{ "node-padding", { .value=&style.NodePadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "node-border-thickness", { .value=&style.NodeBorderThickness, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "link-thickness", { .value=&style.LinkThickness, .min=0.0F, .max=10.0F, .needsScaling=true } },
{ "link-line-segments-per-length", { .value=&style.LinkLineSegmentsPerLength, .min=0.0F, .max=2.0F, .needsScaling=true } },
{ "link-hover-distance", { .value=&style.LinkHoverDistance, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "pin-circle-radius", { .value=&style.PinCircleRadius, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "pin-quad-side-length", { .value=&style.PinQuadSideLength, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "pin-triangle-side-length", { .value=&style.PinTriangleSideLength, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "pin-line-thickness", { .value=&style.PinLineThickness, .min=0.0F, .max=5.0F, .needsScaling=true } },
{ "pin-hover-radius", { .value=&style.PinHoverRadius, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "pin-offset", { .value=&style.PinOffset, .min=-10.0F, .max=10.0F, .needsScaling=true } },
{ "mini-map-padding", { .value=&style.MiniMapPadding, .min=0.0F, .max=20.0F, .needsScaling=true } },
{ "mini-map-offset", { .value=&style.MiniMapOffset, .min=-10.0F, .max=10.0F, .needsScaling=true } },
};
ThemeManager::addStyleHandler("imnodes", ImNodesStyleMap);
@@ -398,8 +398,8 @@ namespace hex::plugin::builtin {
{
auto &style = ImGuiExt::GetCustomStyle();
const static ThemeManager::StyleMap ImHexStyleMap = {
{ "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } },
{ "popup-alpha", { &style.PopupWindowAlpha, 0.0F, 1.0F, false } },
{ "window-blur", { .value=&style.WindowBlur, .min=0.0F, .max=1.0F, .needsScaling=true } },
{ "popup-alpha", { .value=&style.PopupWindowAlpha, .min=0.0F, .max=1.0F, .needsScaling=false } },
};
ThemeManager::addStyleHandler("imhex", ImHexStyleMap);

View File

@@ -24,10 +24,10 @@ namespace hex::plugin::builtin {
};
static std::array bitValues = {
BitValue{ 8, 0.00F, 1.0F, "R", 0 },
BitValue{ 8, 0.33F, 1.0F, "G", 1 },
BitValue{ 8, 0.66F, 1.0F, "B", 2 },
BitValue{ 8, 0.00F, 0.0F, "A", 3 }
BitValue{ .bits=8, .color=0.00F, .saturationMultiplier=1.0F, .name="R", .index=0 },
BitValue{ .bits=8, .color=0.33F, .saturationMultiplier=1.0F, .name="G", .index=1 },
BitValue{ .bits=8, .color=0.66F, .saturationMultiplier=1.0F, .name="B", .index=2 },
BitValue{ .bits=8, .color=0.00F, .saturationMultiplier=0.0F, .name="A", .index=3 }
};
if (ImGui::BeginTable("##color_picker_table", 3, ImGuiTableFlags_BordersInnerV)) {

View File

@@ -25,7 +25,7 @@ namespace hex::plugin::builtin {
class IEEE754STATICS {
public:
IEEE754STATICS() {}
IEEE754STATICS() = default;
u128 value = 0;
i32 exponentBitCount = 8;

View File

@@ -60,7 +60,7 @@ namespace hex::plugin::builtin {
View::toWindowName("hex.builtin.view.data_inspector.name")
})
.onAppear([]{
ImHexApi::HexEditor::setSelection(Region { 0, 1 });
ImHexApi::HexEditor::setSelection(Region { .address=0, .size=1 });
})
.allowSkip();
}

View File

@@ -294,21 +294,21 @@ namespace hex::plugin::builtin {
};
constexpr static std::array Contributors = {
Contributor { "iTrooz", "A huge amount of help maintaining ImHex and the CI", "https://github.com/iTrooz", true },
Contributor { "jumanji144", "A ton of help with the Pattern Language, API and usage stats", "https://github.com/jumanji144", true },
Contributor { "AxCut", "A ton of great pattern language improvements and help with the issue tracker", "https://github.com/paxcut", true },
Contributor { "Mary", "Porting ImHex to macOS originally", "https://github.com/marysaka", false },
Contributor { "Roblabla", "Adding the MSI Windows installer", "https://github.com/roblabla", false },
Contributor { "jam1garner", "Adding support for Rust plugins", "https://github.com/jam1garner", false },
Contributor { "All other amazing contributors", "Being part of the community, opening issues, PRs and donating", "https://github.com/WerWolv/ImHex/graphs/contributors", false }
Contributor { .name="iTrooz", .description="A huge amount of help maintaining ImHex and the CI", .link="https://github.com/iTrooz", .mainContributor=true },
Contributor { .name="jumanji144", .description="A ton of help with the Pattern Language, API and usage stats", .link="https://github.com/jumanji144", .mainContributor=true },
Contributor { .name="AxCut", .description="A ton of great pattern language improvements and help with the issue tracker", .link="https://github.com/paxcut", .mainContributor=true },
Contributor { .name="Mary", .description="Porting ImHex to macOS originally", .link="https://github.com/marysaka", .mainContributor=false },
Contributor { .name="Roblabla", .description="Adding the MSI Windows installer", .link="https://github.com/roblabla", .mainContributor=false },
Contributor { .name="jam1garner", .description="Adding support for Rust plugins", .link="https://github.com/jam1garner", .mainContributor=false },
Contributor { .name="All other amazing contributors", .description="Being part of the community, opening issues, PRs and donating", .link="https://github.com/WerWolv/ImHex/graphs/contributors", .mainContributor=false }
};
constexpr static std::array Testers = {
Contributor { "Nemoumbra", "Breaking my code literal seconds after I push it", "https://github.com/Nemoumbra", true },
Contributor { "Berylskid", "", "https://github.com/Berylskid", false },
Contributor { "Jan Polak", "", "https://github.com/polak-jan", false },
Contributor { "Ken-Kaneki", "", "https://github.com/loneicewolf", false },
Contributor { "Everybody who has reported issues", "Helping me find bugs and improve the software", "https://github.com/WerWolv/ImHex/issues", false }
Contributor { .name="Nemoumbra", .description="Breaking my code literal seconds after I push it", .link="https://github.com/Nemoumbra", .mainContributor=true },
Contributor { .name="Berylskid", .description="", .link="https://github.com/Berylskid", .mainContributor=false },
Contributor { .name="Jan Polak", .description="", .link="https://github.com/polak-jan", .mainContributor=false },
Contributor { .name="Ken-Kaneki", .description="", .link="https://github.com/loneicewolf", .mainContributor=false },
Contributor { .name="Everybody who has reported issues", .description="Helping me find bugs and improve the software", .link="https://github.com/WerWolv/ImHex/issues", .mainContributor=false }
};
@@ -330,52 +330,52 @@ namespace hex::plugin::builtin {
};
constexpr static std::array ImGuiLibraries = {
ExternalResource { "ImGui", "ocornut", "https://github.com/ocornut/imgui" },
ExternalResource { "ImPlot", "epezent", "https://github.com/epezent/implot" },
ExternalResource { "ImPlot3D", "brenocq", "https://github.com/brenocq/implot3d" },
ExternalResource { "imnodes", "Nelarius", "https://github.com/Nelarius/imnodes" },
ExternalResource { "ImGuiColorTextEdit", "BalazsJako", "https://github.com/BalazsJako/ImGuiColorTextEdit" },
ExternalResource { .name="ImGui", .author="ocornut", .link="https://github.com/ocornut/imgui" },
ExternalResource { .name="ImPlot", .author="epezent", .link="https://github.com/epezent/implot" },
ExternalResource { .name="ImPlot3D", .author="brenocq", .link="https://github.com/brenocq/implot3d" },
ExternalResource { .name="imnodes", .author="Nelarius", .link="https://github.com/Nelarius/imnodes" },
ExternalResource { .name="ImGuiColorTextEdit", .author="BalazsJako", .link="https://github.com/BalazsJako/ImGuiColorTextEdit" },
};
constexpr static std::array ExternalLibraries = {
ExternalResource { "PatternLanguage", "WerWolv", "https://github.com/WerWolv/PatternLanguage" },
ExternalResource { "libwolv", "WerWolv", "https://github.com/WerWolv/libwolv" },
ExternalResource { "libromfs", "WerWolv", "https://github.com/WerWolv/libromfs" },
ExternalResource { .name="PatternLanguage", .author="WerWolv", .link="https://github.com/WerWolv/PatternLanguage" },
ExternalResource { .name="libwolv", .author="WerWolv", .link="https://github.com/WerWolv/libwolv" },
ExternalResource { .name="libromfs", .author="WerWolv", .link="https://github.com/WerWolv/libromfs" },
};
constexpr static std::array ThirdPartyLibraries = {
ExternalResource { "json", "nlohmann", "https://github.com/nlohmann/json" },
ExternalResource { "fmt", "fmtlib", "https://github.com/fmtlib/fmt" },
ExternalResource { "nativefiledialog-extended", "btzy", "https://github.com/btzy/nativefiledialog-extended" },
ExternalResource { "xdgpp", "danyspin97", "https://sr.ht/~danyspin97/xdgpp" },
ExternalResource { "capstone", "aquynh", "https://github.com/aquynh/capstone" },
ExternalResource { "microtar", "rxi", "https://github.com/rxi/microtar" },
ExternalResource { "yara", "VirusTotal", "https://github.com/VirusTotal/yara" },
ExternalResource { "edlib", "Martinsos", "https://github.com/Martinsos/edlib" },
ExternalResource { "HashLibPlus", "ron4fun", "https://github.com/ron4fun/HashLibPlus" },
ExternalResource { "miniaudio", "mackron", "https://github.com/mackron/miniaudio" },
ExternalResource { "freetype", "freetype", "https://gitlab.freedesktop.org/freetype/freetype" },
ExternalResource { "mbedTLS", "ARMmbed", "https://github.com/ARMmbed/mbedtls" },
ExternalResource { "curl", "curl", "https://github.com/curl/curl" },
ExternalResource { "file", "file", "https://github.com/file/file" },
ExternalResource { "glfw", "glfw", "https://github.com/glfw/glfw" },
ExternalResource { "llvm", "LLVM Maintainers", "https://github.com/llvm/llvm-project" },
ExternalResource { "Boost.Regex", "John Maddock", "https://github.com/boostorg/regex" },
ExternalResource { "md4c", "mity", "https://github.com/mity/md4c" },
ExternalResource { "lunasvg", "sammycage", "https://github.com/sammycage/lunasvg" },
ExternalResource { "zlib", "madler", "https://github.com/madler/zlib" },
ExternalResource { "bzip2", "federicomenaquintero", "https://gitlab.com/federicomenaquintero/bzip2" },
ExternalResource { "liblzma", "tukaani", "https://github.com/tukaani-project/xz" },
ExternalResource { "zstd", "Facebook", "https://github.com/facebook/zstd" },
ExternalResource { "libssh2", "libssh2 Maintainers", "https://github.com/libssh2/libssh2" },
ExternalResource { .name="json", .author="nlohmann", .link="https://github.com/nlohmann/json" },
ExternalResource { .name="fmt", .author="fmtlib", .link="https://github.com/fmtlib/fmt" },
ExternalResource { .name="nativefiledialog-extended", .author="btzy", .link="https://github.com/btzy/nativefiledialog-extended" },
ExternalResource { .name="xdgpp", .author="danyspin97", .link="https://sr.ht/~danyspin97/xdgpp" },
ExternalResource { .name="capstone", .author="aquynh", .link="https://github.com/aquynh/capstone" },
ExternalResource { .name="microtar", .author="rxi", .link="https://github.com/rxi/microtar" },
ExternalResource { .name="yara", .author="VirusTotal", .link="https://github.com/VirusTotal/yara" },
ExternalResource { .name="edlib", .author="Martinsos", .link="https://github.com/Martinsos/edlib" },
ExternalResource { .name="HashLibPlus", .author="ron4fun", .link="https://github.com/ron4fun/HashLibPlus" },
ExternalResource { .name="miniaudio", .author="mackron", .link="https://github.com/mackron/miniaudio" },
ExternalResource { .name="freetype", .author="freetype", .link="https://gitlab.freedesktop.org/freetype/freetype" },
ExternalResource { .name="mbedTLS", .author="ARMmbed", .link="https://github.com/ARMmbed/mbedtls" },
ExternalResource { .name="curl", .author="curl", .link="https://github.com/curl/curl" },
ExternalResource { .name="file", .author="file", .link="https://github.com/file/file" },
ExternalResource { .name="glfw", .author="glfw", .link="https://github.com/glfw/glfw" },
ExternalResource { .name="llvm", .author="LLVM Maintainers", .link="https://github.com/llvm/llvm-project" },
ExternalResource { .name="Boost.Regex", .author="John Maddock", .link="https://github.com/boostorg/regex" },
ExternalResource { .name="md4c", .author="mity", .link="https://github.com/mity/md4c" },
ExternalResource { .name="lunasvg", .author="sammycage", .link="https://github.com/sammycage/lunasvg" },
ExternalResource { .name="zlib", .author="madler", .link="https://github.com/madler/zlib" },
ExternalResource { .name="bzip2", .author="federicomenaquintero", .link="https://gitlab.com/federicomenaquintero/bzip2" },
ExternalResource { .name="liblzma", .author="tukaani", .link="https://github.com/tukaani-project/xz" },
ExternalResource { .name="zstd", .author="Facebook", .link="https://github.com/facebook/zstd" },
ExternalResource { .name="libssh2", .author="libssh2 Maintainers", .link="https://github.com/libssh2/libssh2" },
};
constexpr static std::array ThirdPartyResources {
ExternalResource { "VSCode Icons", "Microsoft", "https://github.com/microsoft/vscode-codicons" },
ExternalResource { "Blender Icons", "Blender Maintainers", "https://github.com/blender/blender" },
ExternalResource { "Tabler Icons", "codecalm", "https://github.com/tabler/tabler-icons" },
ExternalResource { "JetBrains Mono", "JetBrains", "https://github.com/JetBrains/JetBrainsMono" },
ExternalResource { "Unifont", "GNU", "https://unifoundry.com/unifont" },
ExternalResource { .name="VSCode Icons", .author="Microsoft", .link="https://github.com/microsoft/vscode-codicons" },
ExternalResource { .name="Blender Icons", .author="Blender Maintainers", .link="https://github.com/blender/blender" },
ExternalResource { .name="Tabler Icons", .author="codecalm", .link="https://github.com/tabler/tabler-icons" },
ExternalResource { .name="JetBrains Mono", .author="JetBrains", .link="https://github.com/JetBrains/JetBrainsMono" },
ExternalResource { .name="Unifont", .author="GNU", .link="https://unifoundry.com/unifont" },
};
constexpr static auto drawTable = [](const char *category, const auto &libraries) {
@@ -810,14 +810,14 @@ namespace hex::plugin::builtin {
};
constexpr std::array Tabs = {
Tab { "ImHex", &ViewAbout::drawAboutMainPage },
Tab { "hex.builtin.view.help.about.contributor", &ViewAbout::drawContributorPage },
Tab { "hex.builtin.view.help.about.libs", &ViewAbout::drawLibraryCreditsPage },
Tab { "hex.builtin.view.help.about.plugins", &ViewAbout::drawLoadedPlugins },
Tab { "hex.builtin.view.help.about.paths", &ViewAbout::drawPathsPage },
Tab { "hex.builtin.view.help.about.release_notes", &ViewAbout::drawReleaseNotesPage },
Tab { "hex.builtin.view.help.about.commits", &ViewAbout::drawCommitHistoryPage },
Tab { "hex.builtin.view.help.about.license", &ViewAbout::drawLicensePage },
Tab { .unlocalizedName="ImHex", .function=&ViewAbout::drawAboutMainPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.contributor", .function=&ViewAbout::drawContributorPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.libs", .function=&ViewAbout::drawLibraryCreditsPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.plugins", .function=&ViewAbout::drawLoadedPlugins },
Tab { .unlocalizedName="hex.builtin.view.help.about.paths", .function=&ViewAbout::drawPathsPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.release_notes", .function=&ViewAbout::drawReleaseNotesPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.commits", .function=&ViewAbout::drawCommitHistoryPage },
Tab { .unlocalizedName="hex.builtin.view.help.about.license", .function=&ViewAbout::drawLicensePage },
};
// Allow the window to be closed by pressing ESC

View File

@@ -41,12 +41,12 @@ namespace hex::plugin::builtin {
*id = bookmarkId;
auto bookmark = ImHexApi::Bookmarks::Entry {
region,
name,
std::move(comment),
color,
true,
bookmarkId
.region=region,
.name=name,
.comment=std::move(comment),
.color=color,
.locked=true,
.id=bookmarkId
};
m_bookmarks->emplace_back(std::move(bookmark), true, ui::Markdown(bookmark.comment));
@@ -73,7 +73,7 @@ namespace hex::plugin::builtin {
if (!bookmark.highlightVisible)
continue;
if (Region { address, size }.isWithin(bookmark.entry.region)) {
if (Region { .address=address, .size=size }.isWithin(bookmark.entry.region)) {
color = blendColors(color, bookmark.entry.color);
}
}
@@ -91,7 +91,7 @@ namespace hex::plugin::builtin {
continue;
// Make sure the bookmark overlaps the currently hovered address
if (!Region { address, size }.isWithin(bookmark.region))
if (!Region { .address=address, .size=size }.isWithin(bookmark.region))
continue;
// Draw tooltip
@@ -564,7 +564,7 @@ namespace hex::plugin::builtin {
m_bookmarks.get(provider).push_back({
{
.region = { region["address"], region["size"] },
.region = { .address=region["address"], .size=region["size"] },
.name = bookmark["name"],
.comment = bookmark["comment"],
.color = bookmark["color"],

View File

@@ -282,11 +282,11 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(!selection.has_value() || providerSize < requiredSize || selection->getStartAddress() < baseAddress + requiredSize);
if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_LEFT_PIPE, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSizeSmall)) {
ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() % requiredSize, requiredSize });
ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() % requiredSize, .size=requiredSize });
}
ImGui::SameLine();
if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_LEFT, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSize)) {
ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() - requiredSize, requiredSize });
ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() - requiredSize, .size=requiredSize });
}
ImGui::EndDisabled();
@@ -294,11 +294,11 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(!selection.has_value() || providerSize < requiredSize || selection->getEndAddress() >= providerEndAddress - requiredSize);
if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_RIGHT, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSize)) {
ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress() + requiredSize, requiredSize });
ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress() + requiredSize, .size=requiredSize });
}
ImGui::SameLine();
if (ImGuiExt::DimmedIconButton(ICON_TA_CHEVRON_RIGHT_PIPE, ImGui::GetStyleColorVec4(ImGuiCol_Text), buttonSizeSmall)) {
ImHexApi::HexEditor::setSelection(Region { providerEndAddress - selection->getStartAddress() % requiredSize - requiredSize, requiredSize });
ImHexApi::HexEditor::setSelection(Region { .address=providerEndAddress - selection->getStartAddress() % requiredSize - requiredSize, .size=requiredSize });
}
ImGui::EndDisabled();
}
@@ -444,7 +444,7 @@ namespace hex::plugin::builtin {
if (ImGui::Selectable("##InspectorLine", m_selectedEntryName == entry.unlocalizedName, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap | ImGuiSelectableFlags_AllowDoubleClick)) {
m_selectedEntryName = entry.unlocalizedName;
if (auto selection = ImHexApi::HexEditor::getSelection(); selection.has_value()) {
ImHexApi::HexEditor::setSelection(Region { selection->getStartAddress(), entry.requiredSize });
ImHexApi::HexEditor::setSelection(Region { .address=selection->getStartAddress(), .size=entry.requiredSize });
}
}

View File

@@ -622,7 +622,7 @@ namespace hex::plugin::builtin {
nlohmann::json nodeJson = nlohmann::json::parse(file.readString());
// Add the loaded node to the list of custom nodes
m_customNodes.push_back(CustomNode { Lang(nodeJson.at("name").get<std::string>()), nodeJson });
m_customNodes.push_back(CustomNode { .name=Lang(nodeJson.at("name").get<std::string>()), .data=nodeJson });
} catch (nlohmann::json::exception &e) {
log::warn("Failed to load custom node '{}': {}", entry.path().string(), e.what());
}

View File

@@ -36,7 +36,7 @@ namespace hex::plugin::builtin {
if (m_searchTask.isRunning())
return { };
if (!m_occurrenceTree->overlapping({ address, address }).empty())
if (!m_occurrenceTree->overlapping({ .start=address, .end=address }).empty())
return HighlightColor();
else
return std::nullopt;
@@ -49,7 +49,7 @@ namespace hex::plugin::builtin {
if (m_searchTask.isRunning())
return;
auto occurrences = m_occurrenceTree->overlapping({ address, address + size });
auto occurrences = m_occurrenceTree->overlapping({ .start=address, .end=address + size });
if (occurrences.empty())
return;
@@ -131,7 +131,7 @@ namespace hex::plugin::builtin {
}
m_searchSettings.mode = SearchSettings::Mode::BinaryPattern;
m_searchSettings.region = { selection->getProvider()->getBaseAddress(), selection->getProvider()->getActualSize() };
m_searchSettings.region = { .address=selection->getProvider()->getBaseAddress(), .size=selection->getProvider()->getActualSize() };
m_searchSettings.binaryPattern = {
.input = sequence,
.pattern = hex::BinaryPattern(sequence),
@@ -303,7 +303,7 @@ namespace hex::plugin::builtin {
remainingCharacters = 1;
} else if ((byte & 0b1111'0000) == 0b1110'0000) {
// 3-byte start (U+800..U+FFFF)
validChar = !(byte == 0xE0 || byte == 0xED);
validChar = byte != 0xE0 && byte != 0xED;
// E0 must be followed by >= 0xA0, ED must be <= 0x9F (avoid surrogates)
remainingCharacters = 2;
} else if ((byte & 0b1111'1000) == 0b1111'0000) {
@@ -324,7 +324,7 @@ namespace hex::plugin::builtin {
if (!validChar || startAddress + countedCharacters == endAddress) {
if (countedCharacters >= settings.minLength) {
if (!settings.nullTermination || byte == 0x00) {
results.push_back(Occurrence { Region { startAddress, size_t(countedCharacters) }, endian, decodeType, false, {} });
results.push_back(Occurrence { Region { .address=startAddress, .size=size_t(countedCharacters) }, endian, decodeType, false, {} });
}
}
@@ -412,7 +412,7 @@ namespace hex::plugin::builtin {
auto address = occurrence.getAddress();
reader.seek(address + 1);
results.push_back(Occurrence{ Region { address, bytes.size() }, endian, decodeType, false, {} });
results.push_back(Occurrence{ Region { .address=address, .size=bytes.size() }, endian, decodeType, false, {} });
progress = address - searchRegion.getStartAddress();
}
@@ -473,7 +473,7 @@ namespace hex::plugin::builtin {
if (matchedBytes == settings.pattern.getSize()) {
auto occurrenceAddress = it.getAddress() - (patternSize - 1);
results.push_back(Occurrence { Region { occurrenceAddress, patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} });
results.push_back(Occurrence { Region { .address=occurrenceAddress, .size=patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} });
it.setAddress(occurrenceAddress);
matchedBytes = 0;
}
@@ -499,7 +499,7 @@ namespace hex::plugin::builtin {
}
if (match)
results.push_back(Occurrence { Region { address, patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} });
results.push_back(Occurrence { Region { .address=address, .size=patternSize }, std::endian::native, Occurrence::DecodeType::Binary, false, {} });
}
}
@@ -583,7 +583,7 @@ namespace hex::plugin::builtin {
}
}();
results.push_back(Occurrence { Region { address, size }, settings.endian, decodeType, false, {} });
results.push_back(Occurrence { Region { .address=address, .size=size }, settings.endian, decodeType, false, {} });
}
}
@@ -631,7 +631,7 @@ namespace hex::plugin::builtin {
auto occurrenceAddress = it.getAddress() - (patternSize - 1);
results.push_back(Occurrence {
Region { occurrenceAddress, patternSize },
Region { .address=occurrenceAddress, .size=patternSize },
std::endian::native,
Occurrence::DecodeType::ASCII,
false,
@@ -663,7 +663,7 @@ namespace hex::plugin::builtin {
if (match)
results.push_back(Occurrence {
Region { address, patternSize },
Region { .address=address, .size=patternSize },
std::endian::native,
Occurrence::DecodeType::ASCII,
false,
@@ -723,7 +723,7 @@ namespace hex::plugin::builtin {
m_lastSelectedOccurrence = nullptr;
for (const auto &occurrence : m_foundOccurrences.get(provider))
m_occurrenceTree->insert({ occurrence.region.getStartAddress(), occurrence.region.getEndAddress() }, occurrence);
m_occurrenceTree->insert({ .start=occurrence.region.getStartAddress(), .end=occurrence.region.getEndAddress() }, occurrence);
TaskManager::doLater([this, provider] {
EventHighlightingChanged::post();

View File

@@ -67,7 +67,7 @@ namespace hex::plugin::builtin {
if (!result.has_value()) {
for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getForegroundHighlights()) {
if (highlighting.getRegion().overlaps({ address, size }))
if (highlighting.getRegion().overlaps({ .address=address, .size=size }))
return highlighting.getColor();
}
}
@@ -137,7 +137,7 @@ namespace hex::plugin::builtin {
if (!result.has_value()) {
for (const auto &[id, highlighting] : ImHexApi::HexEditor::impl::getBackgroundHighlights()) {
if (highlighting.getRegion().overlaps({ address, size })) {
if (highlighting.getRegion().overlaps({ .address=address, .size=size })) {
result = blendColors(result, highlighting.getColor());
}
}
@@ -173,7 +173,7 @@ namespace hex::plugin::builtin {
}
for (const auto &[id, tooltip] : ImHexApi::HexEditor::impl::getTooltips()) {
if (tooltip.getRegion().overlaps({ address, size })) {
if (tooltip.getRegion().overlaps({ .address=address, .size=size })) {
ImGui::BeginTooltip();
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
ImGui::TableNextRow();
@@ -991,7 +991,7 @@ namespace hex::plugin::builtin {
/* Paste */
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1450, CurrentView + CTRLCMD + Keys::V,
[this] {
processPasteBehaviour(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())));
processPasteBehaviour(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get())));
},
ImHexApi::HexEditor::isSelectionValid,
this);
@@ -1002,7 +1002,7 @@ namespace hex::plugin::builtin {
/* Paste... > Paste all */
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all" }, ICON_VS_CLIPPY, 1500, CurrentView + CTRLCMD + SHIFT + Keys::V,
[] {
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, false);
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get())), false, false);
},
ImHexApi::HexEditor::isSelectionValid,
this);
@@ -1011,7 +1011,7 @@ namespace hex::plugin::builtin {
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all_string" }, ICON_VS_SYMBOL_KEY, 1510,
Shortcut::None,
[] {
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, true);
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { .address=0, .size=0 }, ImHexApi::Provider::get())), false, true);
},
ImHexApi::HexEditor::isSelectionValid,
this);
@@ -1020,7 +1020,7 @@ namespace hex::plugin::builtin {
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select" }, ICON_VS_LIST_SELECTION, 1525,
CTRLCMD + SHIFT + Keys::A,
[this] {
auto selection = ImHexApi::HexEditor::getSelection().value_or(ImHexApi::HexEditor::ProviderRegion{ { 0, 1 }, nullptr });
auto selection = ImHexApi::HexEditor::getSelection().value_or(ImHexApi::HexEditor::ProviderRegion{ { .address=0, .size=1 }, nullptr });
this->openPopup<PopupSelect>(selection.getStartAddress(), selection.getSize());
},
ImHexApi::Provider::isValid,

View File

@@ -71,7 +71,7 @@ namespace hex::plugin::builtin {
if (!operation->shouldHighlight())
continue;
if (operation->getRegion().overlaps(Region { offset, 1}))
if (operation->getRegion().overlaps(Region { .address=offset, .size=1}))
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Patches);
}
} else {
@@ -79,7 +79,7 @@ namespace hex::plugin::builtin {
if (!operation->shouldHighlight())
continue;
if (operation->getRegion().overlaps(Region { offset, 1}))
if (operation->getRegion().overlaps(Region { .address=offset, .size=1}))
return ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Patches);
}
}

View File

@@ -560,7 +560,7 @@ namespace hex::plugin::builtin {
const auto insertPos = [&, this](u64 address, u32 color) {
const auto progress = float(address - dataBaseAddress) / float(dataSize);
m_accessHistory[m_accessHistoryIndex] = { progress, color };
m_accessHistory[m_accessHistoryIndex] = { .progress=progress, .color=color };
m_accessHistoryIndex = (m_accessHistoryIndex + 1) % m_accessHistory.size();
};
@@ -2272,7 +2272,7 @@ namespace hex::plugin::builtin {
const auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
const auto hoveredRegion = Region { address, size };
const auto hoveredRegion = Region { .address=address, .size=size };
for (const auto &pattern : runtime.getPatternsAtAddress(hoveredRegion.getStartAddress())) {
const pl::ptrn::Pattern * checkPattern = pattern;
if (auto parent = checkPattern->getParent(); parent != nullptr)

View File

@@ -255,7 +255,7 @@ namespace hex::plugin::builtin {
if (colTile.has_value() && nextSegment != *colTile) {
segments.pop_back();
} else {
colTile = { i32(rng() % u32(tileCount.x)), i32(rng() % u32(tileCount.x)) };
colTile = { .x=i32(rng() % u32(tileCount.x)), .y=i32(rng() % u32(tileCount.x)) };
}
} else {
overCounter -= 1;