mirror of https://github.com/WerWolv/ImHex.git
fix: Various clang / clang-tidy warnings (#764)
This commit is contained in:
parent
b365e16cc9
commit
9c484e7b57
|
@ -1 +1 @@
|
|||
Subproject commit 303204a37e07fc2556d476b06acbbdb1e648840e
|
||||
Subproject commit 842227ba459e4387b6208bc4c6686ba423802188
|
|
@ -20,10 +20,6 @@
|
|||
using ImGuiDataType = int;
|
||||
using ImGuiInputTextFlags = int;
|
||||
|
||||
namespace pl {
|
||||
class Evaluator;
|
||||
}
|
||||
|
||||
namespace hex {
|
||||
|
||||
class View;
|
||||
|
@ -61,7 +57,7 @@ namespace hex {
|
|||
return name < other.name;
|
||||
}
|
||||
|
||||
operator const std::string &() const {
|
||||
explicit operator const std::string &() const {
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
@ -435,7 +431,7 @@ namespace hex {
|
|||
|
||||
class Hash {
|
||||
public:
|
||||
Hash(std::string unlocalizedName) : m_unlocalizedName(std::move(unlocalizedName)) {}
|
||||
explicit Hash(std::string unlocalizedName) : m_unlocalizedName(std::move(unlocalizedName)) {}
|
||||
|
||||
class Function {
|
||||
public:
|
||||
|
@ -498,6 +494,6 @@ namespace hex {
|
|||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace hex {
|
|||
mutable std::mutex m_mutex;
|
||||
|
||||
std::string m_unlocalizedName;
|
||||
u64 m_currValue, m_maxValue;
|
||||
u64 m_currValue = 0, m_maxValue = 0;
|
||||
std::thread m_thread;
|
||||
std::function<void()> m_interruptCallback;
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace hex {
|
|||
|
||||
namespace first_time_exec {
|
||||
|
||||
#define FIRST_TIME [[maybe_unused]] static auto ANONYMOUS_VARIABLE(FIRST_TIME_) = ::hex::first_time_exec::FirstTimeExecutor() + [&]()
|
||||
#define FIRST_TIME [[maybe_unused]] static auto ANONYMOUS_VARIABLE(FIRST_TIME_) = ::hex::first_time_exec::FirstTimeExecutor() + [&]()
|
||||
|
||||
template<class F>
|
||||
class FirstTimeExecute {
|
||||
|
@ -358,7 +358,7 @@ namespace hex {
|
|||
|
||||
namespace final_cleanup {
|
||||
|
||||
#define FINAL_CLEANUP [[maybe_unused]] static auto ANONYMOUS_VARIABLE(ON_EXIT_) = ::hex::final_cleanup::FinalCleanupExecutor() + [&]()
|
||||
#define FINAL_CLEANUP [[maybe_unused]] static auto ANONYMOUS_VARIABLE(ON_EXIT_) = ::hex::final_cleanup::FinalCleanupExecutor() + [&]()
|
||||
|
||||
template<class F>
|
||||
class FinalCleanupExecute {
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace hex::prv {
|
|||
void markDirty(bool dirty = true) { this->m_dirty = dirty; }
|
||||
[[nodiscard]] bool isDirty() const { return this->m_dirty; }
|
||||
|
||||
virtual std::pair<Region, bool> getRegionValidity(u64 address) const;
|
||||
[[nodiscard]] virtual std::pair<Region, bool> getRegionValidity(u64 address) const;
|
||||
|
||||
void skipLoadInterface() { this->m_skipLoadInterface = true; }
|
||||
[[nodiscard]] bool shouldSkipLoadInterface() const { return this->m_skipLoadInterface; }
|
||||
|
|
|
@ -35,14 +35,14 @@ namespace ImGui {
|
|||
public:
|
||||
Texture() = default;
|
||||
Texture(const ImU8 *buffer, int size);
|
||||
Texture(const char *path);
|
||||
explicit Texture(const char *path);
|
||||
Texture(const Texture&) = delete;
|
||||
Texture(Texture&& other) noexcept;
|
||||
|
||||
~Texture();
|
||||
|
||||
void operator=(const Texture&) = delete;
|
||||
void operator=(Texture&& other) noexcept;
|
||||
Texture& operator=(const Texture&) = delete;
|
||||
Texture& operator=(Texture&& other) noexcept;
|
||||
|
||||
[[nodiscard]] constexpr bool isValid() const noexcept {
|
||||
return this->m_textureId != nullptr;
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace hex::fs {
|
|||
path = path / folder;
|
||||
|
||||
return paths;
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<std::fs::path> getPluginPaths() {
|
||||
std::vector<std::fs::path> paths = getDataPaths();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_freetype.h>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui_internal.h>
|
||||
#undef IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
@ -69,12 +68,14 @@ namespace ImGui {
|
|||
other.m_textureId = nullptr;
|
||||
}
|
||||
|
||||
void Texture::operator=(Texture&& other) noexcept {
|
||||
Texture& Texture::operator=(Texture&& other) noexcept {
|
||||
this->m_textureId = other.m_textureId;
|
||||
this->m_width = other.m_width;
|
||||
this->m_height = other.m_height;
|
||||
|
||||
other.m_textureId = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Texture::~Texture() {
|
||||
|
@ -103,8 +104,8 @@ namespace ImGui {
|
|||
|
||||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
ImVec2 label_size = CalcTextSize(icon, NULL, false);
|
||||
label_size.x += CalcTextSize(" ", NULL, false).x + CalcTextSize(label, NULL, false).x;
|
||||
ImVec2 label_size = CalcTextSize(icon, nullptr, false);
|
||||
label_size.x += CalcTextSize(" ", nullptr, false).x + CalcTextSize(label, nullptr, false).x;
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y);
|
||||
|
@ -137,7 +138,7 @@ namespace ImGui {
|
|||
|
||||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y);
|
||||
|
@ -154,7 +155,7 @@ namespace ImGui {
|
|||
// Render
|
||||
const ImU32 col = hovered ? GetColorU32(ImGuiCol_ButtonHovered) : GetColorU32(ImGuiCol_ButtonActive);
|
||||
PushStyleColor(ImGuiCol_Text, ImU32(col));
|
||||
TextEx(label, NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
|
||||
TextEx(label, nullptr, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
|
||||
GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(col));
|
||||
PopStyleColor();
|
||||
|
||||
|
@ -170,7 +171,7 @@ namespace ImGui {
|
|||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y) + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f);
|
||||
|
@ -205,8 +206,8 @@ namespace ImGui {
|
|||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 text_size = CalcTextSize((std::string(label) + "\n " + std::string(description)).c_str(), NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 text_size = CalcTextSize((std::string(label) + "\n " + std::string(description)).c_str(), nullptr, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
|
||||
|
@ -234,7 +235,7 @@ namespace ImGui {
|
|||
RenderTextWrapped(bb.Min + style.FramePadding * 2, label, nullptr, CalcWrapWidthForPos(window->DC.CursorPos, window->DC.TextWrapPos));
|
||||
PopStyleColor();
|
||||
PushStyleColor(ImGuiCol_Text, GetColorU32(ImGuiCol_Text));
|
||||
RenderTextClipped(bb.Min + style.FramePadding * 2 + ImVec2(style.FramePadding.x * 2, label_size.y), bb.Max - style.FramePadding, description, NULL, &text_size, style.ButtonTextAlign, &bb);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * 2 + ImVec2(style.FramePadding.x * 2, label_size.y), bb.Max - style.FramePadding, description, nullptr, &text_size, style.ButtonTextAlign, &bb);
|
||||
PopStyleColor();
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
|
@ -250,13 +251,13 @@ namespace ImGui {
|
|||
void UnderlinedText(const char *label, ImColor color, const ImVec2 &size_arg) {
|
||||
ImGuiWindow *window = GetCurrentWindow();
|
||||
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y);
|
||||
|
||||
PushStyleColor(ImGuiCol_Text, ImU32(color));
|
||||
TextEx(label, NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
|
||||
TextEx(label, nullptr, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
|
||||
GetWindowDrawList()->AddLine(ImVec2(pos.x, pos.y + size.y), pos + size, ImU32(color));
|
||||
PopStyleColor();
|
||||
}
|
||||
|
@ -382,7 +383,7 @@ namespace ImGui {
|
|||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
|
||||
|
@ -401,7 +402,7 @@ namespace ImGui {
|
|||
: ImGuiCol_Button);
|
||||
RenderNavHighlight(bb, id);
|
||||
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, label, nullptr, &label_size, style.ButtonTextAlign, &bb);
|
||||
|
||||
// Automatically close popups
|
||||
// if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
|
||||
|
@ -421,7 +422,7 @@ namespace ImGui {
|
|||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = window->GetID(symbol);
|
||||
const ImVec2 label_size = CalcTextSize(symbol, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(symbol, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
|
||||
|
@ -442,7 +443,7 @@ namespace ImGui {
|
|||
: ImGuiCol_MenuBarBg);
|
||||
RenderNavHighlight(bb, id);
|
||||
RenderFrame(bb.Min, bb.Max, col, false, style.FrameRounding);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, symbol, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, symbol, nullptr, &label_size, style.ButtonTextAlign, &bb);
|
||||
|
||||
PopStyleColor();
|
||||
|
||||
|
@ -464,7 +465,7 @@ namespace ImGui {
|
|||
ImGuiContext &g = *GImGui;
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = window->GetID(symbol);
|
||||
const ImVec2 label_size = CalcTextSize(symbol, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(symbol, nullptr, true);
|
||||
|
||||
ImVec2 pos = window->DC.CursorPos;
|
||||
|
||||
|
@ -485,7 +486,7 @@ namespace ImGui {
|
|||
: ImGuiCol_Button);
|
||||
RenderNavHighlight(bb, id);
|
||||
RenderFrame(bb.Min, bb.Max, col, false, style.FrameRounding);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, symbol, NULL, &label_size, style.ButtonTextAlign, &bb);
|
||||
RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1, 2), bb.Max - style.FramePadding, symbol, nullptr, &label_size, style.ButtonTextAlign, &bb);
|
||||
|
||||
PopStyleColor();
|
||||
|
||||
|
@ -609,7 +610,7 @@ namespace ImGui {
|
|||
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
if (format == NULL)
|
||||
if (format == nullptr)
|
||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||
|
||||
char buf[64];
|
||||
|
@ -648,7 +649,7 @@ namespace ImGui {
|
|||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
|
||||
|
||||
const ImVec2 size = ImVec2(CalcTextSize("0").x + style.FramePadding.x * 2, GetFrameHeight());
|
||||
const ImVec2 pos = window->DC.CursorPos;
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace hex {
|
|||
|
||||
double m_lastFrameTime = 0;
|
||||
|
||||
ImGui::Texture m_logoTexture = { nullptr };
|
||||
ImGui::Texture m_logoTexture;
|
||||
|
||||
std::mutex m_popupMutex;
|
||||
std::list<std::string> m_popupsToOpen;
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace hex {
|
|||
#else
|
||||
std::raise(signalNumber);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
Window::Window() {
|
||||
{
|
||||
|
@ -199,9 +199,16 @@ namespace hex {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
this->frameBegin();
|
||||
this->frame();
|
||||
|
||||
try {
|
||||
this->frame();
|
||||
} catch (const std::exception &e) {
|
||||
log::error("Exception thrown in main loop: {}", e.what());
|
||||
} catch (...) {
|
||||
log::error("Unknown exception thrown in main loop!");
|
||||
}
|
||||
|
||||
this->frameEnd();
|
||||
|
||||
const auto targetFps = ImHexApi::System::getTargetFPS();
|
||||
|
|
|
@ -40,4 +40,4 @@ namespace hex {
|
|||
private:
|
||||
std::map<const pl::ptrn::Pattern*, u64> m_displayEnd;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -45,7 +45,7 @@ namespace hex::plugin::builtin::prv {
|
|||
return "hex.builtin.provider.disk";
|
||||
}
|
||||
|
||||
std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
[[nodiscard]] std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
|
||||
protected:
|
||||
void reloadDrives();
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace hex::plugin::builtin::prv {
|
|||
[[nodiscard]] std::string getName() const override;
|
||||
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override;
|
||||
|
||||
bool hasFilePicker() const override { return true; }
|
||||
bool handleFilePicker() override;
|
||||
[[nodiscard]] bool hasFilePicker() const override { return true; }
|
||||
[[nodiscard]] bool handleFilePicker() override;
|
||||
|
||||
void setPath(const std::fs::path &path);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace hex::plugin::builtin::prv {
|
|||
return "hex.builtin.provider.gdb";
|
||||
}
|
||||
|
||||
std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
[[nodiscard]] std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
|
||||
protected:
|
||||
hex::Socket m_socket;
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace hex::plugin::builtin::prv {
|
|||
return "hex.builtin.provider.intel_hex";
|
||||
}
|
||||
|
||||
bool hasFilePicker() const override { return true; }
|
||||
bool handleFilePicker() override;
|
||||
[[nodiscard]] bool hasFilePicker() const override { return true; }
|
||||
[[nodiscard]] bool handleFilePicker() override;
|
||||
|
||||
std::pair<Region, bool> getRegionValidity(u64 address) const override;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace hex::plugin::builtin {
|
|||
const static inline auto FormattingUpperCase = hex::format("%0{}X", CharCount);
|
||||
const static inline auto FormattingLowerCase = hex::format("%0{}x", CharCount);
|
||||
|
||||
const char *getFormatString(bool upperCase) {
|
||||
static const char *getFormatString(bool upperCase) {
|
||||
if (upperCase)
|
||||
return FormattingUpperCase.c_str();
|
||||
else
|
||||
|
@ -237,7 +237,7 @@ namespace hex::plugin::builtin {
|
|||
const static inline auto FormatStringUpperCase = hex::format("%{}G", CharCount);
|
||||
const static inline auto FormatStringLowerCase = hex::format("%{}g", CharCount);
|
||||
|
||||
const char *getFormatString(bool upperCase) {
|
||||
static const char *getFormatString(bool upperCase) {
|
||||
if (upperCase)
|
||||
return FormatStringUpperCase.c_str();
|
||||
else
|
||||
|
|
|
@ -430,4 +430,4 @@ namespace hex {
|
|||
auto [value, success] = this->m_displayEnd.emplace(&pattern, DisplayEndDefault);
|
||||
return value->second;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace {
|
||||
static std::vector<std::fs::path> userFolders;
|
||||
static void loadUserFoldersFromSetting(nlohmann::json &setting) {
|
||||
|
||||
std::vector<std::fs::path> userFolders;
|
||||
|
||||
void loadUserFoldersFromSetting(nlohmann::json &setting) {
|
||||
userFolders.clear();
|
||||
std::vector<std::string> paths = setting;
|
||||
for (const auto &path : paths) {
|
||||
|
@ -24,7 +26,8 @@ namespace {
|
|||
userFolders.emplace_back(uString);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace hex::plugin::builtin {
|
|||
case F64: return parseNumericValue<double, double>(input);
|
||||
default: return { false, { }, 0 };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static std::string formatBytes(const std::vector<u8> &bytes) {
|
||||
|
|
|
@ -1016,13 +1016,13 @@ namespace hex::plugin::builtin {
|
|||
if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && providerData.selectionStart != providerData.selectionEnd)) {
|
||||
auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1);
|
||||
|
||||
if (y == u64(clipper.DisplayStart + 3)) {
|
||||
if (y == (u64(clipper.DisplayStart) + 3)) {
|
||||
if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 3) * this->m_bytesPerRow)) {
|
||||
this->m_shouldScrollToSelection = false;
|
||||
ImGui::SetScrollHereY(fractionPerLine * 5);
|
||||
|
||||
}
|
||||
} else if (y == u64(clipper.DisplayEnd - 3)) {
|
||||
} else if (y == (u64(clipper.DisplayStart) - 3)) {
|
||||
if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 3) * this->m_bytesPerRow)) {
|
||||
this->m_shouldScrollToSelection = false;
|
||||
ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1));
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace hex::plugin::builtin {
|
|||
|
||||
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
|
||||
if (this->m_blockSize != 0)
|
||||
this->m_entropyHandlePosition = region.getStartAddress() / this->m_blockSize;
|
||||
this->m_entropyHandlePosition = region.getStartAddress() / double(this->m_blockSize);
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderDeleted>(this, [this](const auto*) {
|
||||
|
|
|
@ -642,11 +642,11 @@ namespace hex::plugin::builtin {
|
|||
ImGui::InputScalar(label.c_str(), ImGuiDataType_U64, &value);
|
||||
variable.value = u128(value);
|
||||
} else if (pl::core::Token::isFloatingPoint(variable.type)) {
|
||||
double value = hex::get_or<double>(variable.value, 0.0);
|
||||
auto value = hex::get_or<double>(variable.value, 0.0);
|
||||
ImGui::InputScalar(label.c_str(), ImGuiDataType_Double, &value);
|
||||
variable.value = value;
|
||||
} else if (variable.type == pl::core::Token::ValueType::Boolean) {
|
||||
bool value = hex::get_or<bool>(variable.value, false);
|
||||
auto value = hex::get_or<bool>(variable.value, false);
|
||||
ImGui::Checkbox(label.c_str(), &value);
|
||||
variable.value = value;
|
||||
} else if (variable.type == pl::core::Token::ValueType::Character) {
|
||||
|
|
|
@ -50,10 +50,11 @@ namespace hex::plugin::builtin {
|
|||
|
||||
for (auto &it : sortedCategories) {
|
||||
auto &[category, settings] = *it;
|
||||
if (ImGui::BeginTabItem(LangEntry(category))) {
|
||||
const std::string &categoryDesc = descriptions.count(category) ? descriptions.at(category) : category.name;
|
||||
if (ImGui::BeginTabItem(LangEntry(category.name))) {
|
||||
const std::string &categoryDesc = descriptions.contains(category.name) ? descriptions.at(category.name) : category.name;
|
||||
|
||||
LangEntry descriptionEntry{categoryDesc};
|
||||
ImGui::TextWrapped("%s", static_cast<const char*>(descriptionEntry));
|
||||
ImGui::TextFormattedWrapped("{}", descriptionEntry);
|
||||
ImGui::InfoTooltip(descriptionEntry);
|
||||
ImGui::Separator();
|
||||
|
||||
|
@ -85,7 +86,7 @@ namespace hex::plugin::builtin {
|
|||
} else
|
||||
this->getWindowOpenState() = false;
|
||||
|
||||
if (this->getWindowOpenState() == false && this->m_restartRequested) {
|
||||
if (!this->getWindowOpenState() && this->m_restartRequested) {
|
||||
View::showYesNoQuestionPopup("hex.builtin.view.settings.restart_question"_lang, ImHexApi::Common::restartImHex, [] {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace hex::plugin::windows {
|
|||
View::showErrorPopup("hex.windows.view.tty_console.no_available_port"_lang);
|
||||
return true; // If false, connect_error error popup will override this error popup
|
||||
}
|
||||
this->m_portHandle = ::CreateFile(("\\\\.\\" + this->m_comPorts[this->m_selectedPort].first).c_str(),
|
||||
this->m_portHandle = ::CreateFile((R"(\\.\)" + this->m_comPorts[this->m_selectedPort].first).c_str(),
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
nullptr,
|
||||
|
|
Loading…
Reference in New Issue