mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 21:47:40 -05:00
fix: Further MSVC compile fixes
This commit is contained in:
@@ -270,7 +270,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
std::memcpy(static_cast<u8 *>(buffer) + (offset - startOffset), m_sectorBuffer.data() + (offset & (m_sectorSize - 1)), std::min<u64>(m_sectorSize, size));
|
||||
|
||||
size = std::max<ssize_t>(static_cast<ssize_t>(size) - m_sectorSize, 0);
|
||||
size = std::max<i64>(static_cast<i64>(size) - m_sectorSize, 0);
|
||||
offset += m_sectorSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace hex::plugin::builtin {
|
||||
class FPSWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||
public:
|
||||
bool draw(const std::string &name) override {
|
||||
auto format = [this] -> std::string {
|
||||
auto format = [this]() -> std::string {
|
||||
if (m_value > 200)
|
||||
return "hex.builtin.setting.interface.fps.unlocked"_lang;
|
||||
else if (m_value < 15)
|
||||
@@ -177,7 +177,7 @@ namespace hex::plugin::builtin {
|
||||
class ScalingWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||
public:
|
||||
bool draw(const std::string &name) override {
|
||||
auto format = [this] -> std::string {
|
||||
auto format = [this]() -> std::string {
|
||||
if (m_value == 0)
|
||||
return hex::format("{} (x{:.1f})", "hex.builtin.setting.interface.scaling.native"_lang, ImHexApi::System::getNativeScale());
|
||||
else
|
||||
@@ -219,7 +219,7 @@ namespace hex::plugin::builtin {
|
||||
class AutoBackupWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||
public:
|
||||
bool draw(const std::string &name) override {
|
||||
auto format = [this] -> std::string {
|
||||
auto format = [this]() -> std::string {
|
||||
auto value = m_value * 30;
|
||||
if (value == 0)
|
||||
return "hex.ui.common.off"_lang;
|
||||
|
||||
@@ -203,11 +203,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ThemeManager::addThemeHandler("imhex", ImHexColorMap,
|
||||
[](u32 colorId) -> ImColor {
|
||||
return static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId];
|
||||
return static_cast<ImGuiExt::ImHexCustomData *>(ImGui::GetCurrentContext()->IO.UserData)->Colors[colorId];
|
||||
|
||||
},
|
||||
[](u32 colorId, ImColor color) {
|
||||
static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId] = color;
|
||||
static_cast<ImGuiExt::ImHexCustomData *>(ImGui::GetCurrentContext()->IO.UserData)->Colors[colorId] = color;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace hex::plugin::builtin {
|
||||
return hex::format("{{ {}%, {}%, {}%, {}% }}", u32(floatColor[0] * 100), u32(floatColor[1] * 100), u32(floatColor[2] * 100), u32(floatColor[3] * 100));
|
||||
});
|
||||
|
||||
drawValue("hex.builtin.tools.color.formats.color_name"_lang, [&] -> std::string {
|
||||
drawValue("hex.builtin.tools.color.formats.color_name"_lang, [&]() -> std::string {
|
||||
const static auto ColorTable = [] {
|
||||
auto colorMap = nlohmann::json::parse(romfs::get("assets/common/color_names.json").string()).get<std::map<std::string, std::string>>();
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace hex::plugin::builtin {
|
||||
} else {
|
||||
/* Gutmann's method. Secure for magnetic storage */
|
||||
std::random_device rd;
|
||||
std::uniform_int_distribution<u8> dist(0x00, 0xFF);
|
||||
std::uniform_int_distribution<u16> dist(0x00, 0xFF);
|
||||
|
||||
/* Fill fixed patterns */
|
||||
overwritePattern = {
|
||||
@@ -111,9 +111,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
/* Fill random patterns */
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
overwritePattern[i] = { dist(rd), dist(rd), dist(rd) };
|
||||
overwritePattern[i] = { u8(dist(rd)), u8(dist(rd)), u8(dist(rd)) };
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
overwritePattern[overwritePattern.size() - 1 - i] = { dist(rd), dist(rd), dist(rd) };
|
||||
overwritePattern[overwritePattern.size() - 1 - i] = { u8(dist(rd)), u8(dist(rd)), u8(dist(rd)) };
|
||||
}
|
||||
|
||||
size_t fileSize = file.getSize();
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <wolv/math_eval/math_evaluator.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <implot.h>
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name = Lang(this->getUnlocalizedName());
|
||||
std::string m_name = Lang(this->getUnlocalizedName()).get();
|
||||
int m_type = 0;
|
||||
|
||||
std::variant<i128, long double, std::vector<u8>> m_value;
|
||||
@@ -156,7 +156,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name = Lang(this->getUnlocalizedName());
|
||||
std::string m_name = Lang(this->getUnlocalizedName()).get();
|
||||
int m_type = 0;
|
||||
|
||||
std::variant<i128, long double, std::vector<u8>> m_value;
|
||||
@@ -344,7 +344,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name = "hex.builtin.nodes.custom.custom.header"_lang;
|
||||
std::string m_name = "hex.builtin.nodes.custom.custom.header"_lang.get();
|
||||
|
||||
bool m_editable = false;
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace hex::plugin::builtin {
|
||||
reader.seek(searchRegion.getStartAddress());
|
||||
reader.setEndAddress(searchRegion.getEndAddress());
|
||||
|
||||
const auto [decodeType, endian] = [&] -> std::pair<Occurrence::DecodeType, std::endian> {
|
||||
const auto [decodeType, endian] = [&]() -> std::pair<Occurrence::DecodeType, std::endian> {
|
||||
if (settings.type == ASCII)
|
||||
return { Occurrence::DecodeType::ASCII, std::endian::native };
|
||||
if (settings.type == UTF8)
|
||||
@@ -344,7 +344,7 @@ namespace hex::plugin::builtin {
|
||||
auto occurrence = reader.begin();
|
||||
u64 progress = 0;
|
||||
|
||||
auto searchPredicate = [&] -> bool(*)(u8, u8) {
|
||||
auto searchPredicate = [&]() -> bool(*)(u8, u8) {
|
||||
if (!settings.ignoreCase)
|
||||
return [](u8 left, u8 right) -> bool {
|
||||
return left == right;
|
||||
|
||||
@@ -1200,7 +1200,7 @@ namespace hex::plugin::builtin {
|
||||
auto encoding = EncodingFile(EncodingFile::Type::Thingy, path);
|
||||
ImHexApi::Provider::markDirty();
|
||||
|
||||
TaskManager::doLater([this, encoding = std::move(encoding)] mutable {
|
||||
TaskManager::doLater([this, encoding = std::move(encoding)]() mutable {
|
||||
m_hexEditor.setCustomEncoding(std::move(encoding));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
|
||||
static float height = 0;
|
||||
static bool dragging = false;
|
||||
const ImGuiContext& g = *GImGui;
|
||||
const ImGuiContext& g = *ImGui::GetCurrentContext();
|
||||
if (g.CurrentWindow->Appearing)
|
||||
return;
|
||||
const auto availableSize = g.CurrentWindow->Size;
|
||||
@@ -1292,7 +1292,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGuiExt::DimmedIconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
auto dataProvider = std::make_shared<prv::MemoryProvider>(section.data);
|
||||
auto hexEditor = auto(m_sectionHexEditor);
|
||||
auto hexEditor = ui::HexEditor(m_sectionHexEditor);
|
||||
|
||||
hexEditor.setBackgroundHighlightCallback([this, id, &runtime](u64 address, const u8 *, size_t) -> std::optional<color_t> {
|
||||
if (m_runningEvaluators != 0)
|
||||
@@ -1318,14 +1318,14 @@ namespace hex::plugin::builtin {
|
||||
auto patternProvider = ImHexApi::Provider::get();
|
||||
|
||||
|
||||
m_sectionWindowDrawer[patternProvider] = [this, id, patternProvider, dataProvider, hexEditor, patternDrawer = std::make_shared<ui::PatternDrawer>(), &runtime] mutable {
|
||||
m_sectionWindowDrawer[patternProvider] = [this, id, patternProvider, dataProvider, hexEditor, patternDrawer = std::make_shared<ui::PatternDrawer>(), &runtime]() mutable {
|
||||
hexEditor.setProvider(dataProvider.get());
|
||||
hexEditor.draw(480_scaled);
|
||||
patternDrawer->setSelectionCallback([&](const pl::ptrn::Pattern *pattern) {
|
||||
hexEditor.setSelection(Region { pattern->getOffset(), pattern->getSize() });
|
||||
});
|
||||
|
||||
const auto &patterns = [&, this] -> const auto& {
|
||||
const auto &patterns = [&, this]() -> const auto& {
|
||||
if (patternProvider->isReadable() && *m_executionDone) {
|
||||
return runtime.getPatterns(id);
|
||||
} else {
|
||||
@@ -1556,7 +1556,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Format: [ AA BB CC DD ] @ 0x12345678
|
||||
runtime.addPragma("magic", [provider, &foundCorrectType](pl::PatternLanguage &, const std::string &value) -> bool {
|
||||
const auto pattern = [value = value] mutable -> std::optional<BinaryPattern> {
|
||||
const auto pattern = [value = value]() mutable -> std::optional<BinaryPattern> {
|
||||
value = wolv::util::trim(value);
|
||||
|
||||
if (value.empty())
|
||||
@@ -1577,7 +1577,7 @@ namespace hex::plugin::builtin {
|
||||
return BinaryPattern(value);
|
||||
}();
|
||||
|
||||
const auto address = [value = value, provider] mutable -> std::optional<u64> {
|
||||
const auto address = [value = value, provider]() mutable -> std::optional<u64> {
|
||||
value = wolv::util::trim(value);
|
||||
|
||||
if (value.empty())
|
||||
|
||||
Reference in New Issue
Block a user