fix: Further MSVC compile fixes
This commit is contained in:
parent
8d1352ddff
commit
3f6b5203ca
@ -570,7 +570,7 @@ endmacro()
|
||||
macro(setupCompilerFlags target)
|
||||
# IMHEX_COMMON_FLAGS: flags common for C, C++, Objective C, etc.. compilers
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
# Define strict compilation flags
|
||||
if (IMHEX_STRICT_WARNINGS)
|
||||
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -Wall -Wextra -Wpedantic -Werror")
|
||||
@ -584,6 +584,8 @@ macro(setupCompilerFlags target)
|
||||
|
||||
# Disable some warnings
|
||||
set(IMHEX_C_CXX_FLAGS "-Wno-array-bounds -Wno-deprecated-declarations -Wno-unknown-pragmas")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
set(IMHEX_CXX_FLAGS "/EHsc")
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
|
2
lib/external/disassembler
vendored
2
lib/external/disassembler
vendored
@ -1 +1 @@
|
||||
Subproject commit 33b751c17e47318355e052c285a198502507de16
|
||||
Subproject commit bc4a5d99756387850007d71b64d216c3f2d8d30a
|
2
lib/external/libwolv
vendored
2
lib/external/libwolv
vendored
@ -1 +1 @@
|
||||
Subproject commit ed607b3487756c80a3be10bdd86648e1ecb18a86
|
||||
Subproject commit 9d38dd5b48e429d4f1d7c71dc2684a6ab42b6f92
|
@ -721,7 +721,7 @@ namespace hex {
|
||||
add(impl::Entry {
|
||||
unlocalizedCategory,
|
||||
unlocalizedName,
|
||||
[=, ...args = std::forward<Args>(args)] mutable {
|
||||
[=, ...args = std::forward<Args>(args)]() mutable {
|
||||
auto node = std::make_unique<T>(std::forward<Args>(args)...);
|
||||
node->setUnlocalizedName(unlocalizedName);
|
||||
return node;
|
||||
@ -1002,7 +1002,7 @@ namespace hex {
|
||||
void add(bool addToList = true) {
|
||||
auto typeName = T().getTypeName();
|
||||
|
||||
impl::add(typeName, [] -> std::unique_ptr<prv::Provider> {
|
||||
impl::add(typeName, []() -> std::unique_ptr<prv::Provider> {
|
||||
return std::make_unique<T>();
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace hex::dp {
|
||||
const i128& Node::getIntegerOnInput(u32 index) {
|
||||
auto attribute = this->getConnectedInputAttribute(index);
|
||||
|
||||
auto &outputData = [&] -> std::vector<u8>& {
|
||||
auto &outputData = [&]() -> std::vector<u8>&{
|
||||
if (attribute != nullptr) {
|
||||
if (attribute->getType() != Attribute::Type::Integer)
|
||||
throwNodeError("Tried to read integer from non-integer attribute");
|
||||
@ -68,7 +68,7 @@ namespace hex::dp {
|
||||
const double& Node::getFloatOnInput(u32 index) {
|
||||
auto attribute = this->getConnectedInputAttribute(index);
|
||||
|
||||
auto &outputData = [&] -> std::vector<u8>& {
|
||||
auto &outputData = [&]() -> std::vector<u8>&{
|
||||
if (attribute != nullptr) {
|
||||
if (attribute->getType() != Attribute::Type::Float)
|
||||
throwNodeError("Tried to read integer from non-float attribute");
|
||||
|
2
lib/third_party/imgui/CMakeLists.txt
vendored
2
lib/third_party/imgui/CMakeLists.txt
vendored
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(imgui)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
add_library(imgui_all_includes INTERFACE)
|
||||
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/BalazsJako/ImGuiColorTextEdit
|
||||
project(imgui_color_text_editor)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_color_text_editor OBJECT
|
||||
|
2
lib/third_party/imgui/backend/CMakeLists.txt
vendored
2
lib/third_party/imgui/backend/CMakeLists.txt
vendored
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/ocornut/imgui backends with custom modifications made to the OpenGL 3 and GLFW backends
|
||||
project(imgui_backend)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_backend OBJECT
|
||||
|
2
lib/third_party/imgui/cimgui/CMakeLists.txt
vendored
2
lib/third_party/imgui/cimgui/CMakeLists.txt
vendored
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/cimgui/cimgui
|
||||
project(imgui_cimgui)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_cimgui OBJECT
|
||||
|
2
lib/third_party/imgui/imgui/CMakeLists.txt
vendored
2
lib/third_party/imgui/imgui/CMakeLists.txt
vendored
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/ocornut/imgui
|
||||
project(imgui_imgui)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_imgui OBJECT
|
||||
|
2
lib/third_party/imgui/imnodes/CMakeLists.txt
vendored
2
lib/third_party/imgui/imnodes/CMakeLists.txt
vendored
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/Nelarius/imnodes
|
||||
project(imgui_imnodes)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_imnodes OBJECT
|
||||
|
2
lib/third_party/imgui/implot/CMakeLists.txt
vendored
2
lib/third_party/imgui/implot/CMakeLists.txt
vendored
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/epezent/implot
|
||||
project(imgui_implot)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_implot OBJECT
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
# https://github.com/brenocq/implot3d
|
||||
project(imgui_implot3d)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
add_library(imgui_implot3d OBJECT
|
||||
|
@ -255,7 +255,7 @@ namespace hex {
|
||||
return HTCAPTION;
|
||||
}
|
||||
|
||||
std::string_view hoveredWindowName = GImGui->HoveredWindow == nullptr ? "" : GImGui->HoveredWindow->Name;
|
||||
std::string_view hoveredWindowName = ImGui::GetCurrentContext()->HoveredWindow == nullptr ? "" : GImGui->HoveredWindow->Name;
|
||||
|
||||
if (!ImHexApi::System::impl::isWindowResizable()) {
|
||||
if (result != RegionClient) {
|
||||
|
@ -546,7 +546,7 @@ namespace hex {
|
||||
const auto maxWindowPos = ImHexApi::System::getMainWindowPosition() + ImHexApi::System::getMainWindowSize();
|
||||
if (currWindowPos.x > maxWindowPos.x || currWindowPos.y > maxWindowPos.y || currWindowPos.x < minWindowPos.x || currWindowPos.y < minWindowPos.y) {
|
||||
positionSet = false;
|
||||
GImGui->MovingWindow = nullptr;
|
||||
ImGui::GetCurrentContext()->MovingWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1142,7 +1142,7 @@ namespace hex {
|
||||
Duration requestedFrameTime = {}, remainingUnlockedTime = {};
|
||||
float targetFps = 0;
|
||||
|
||||
const auto nativeFps = [] -> float {
|
||||
const auto nativeFps = []() -> float {
|
||||
if (const auto monitor = glfwGetPrimaryMonitor(); monitor != nullptr) {
|
||||
if (const auto videoMode = glfwGetVideoMode(monitor); videoMode != nullptr) {
|
||||
return videoMode->refreshRate;
|
||||
|
@ -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())
|
||||
|
@ -111,7 +111,7 @@ namespace hex::script::loader {
|
||||
= getExport<hostfxr_set_error_writer_fn>(hostfxrLibrary, "hostfxr_set_error_writer");
|
||||
}
|
||||
|
||||
hostfxr_set_error_writer([] HOSTFXR_CALLTYPE (const char_t *) { });
|
||||
hostfxr_set_error_writer([] (const char_t *) { });
|
||||
|
||||
return
|
||||
hostfxr_initialize_for_runtime_config != nullptr &&
|
||||
@ -146,7 +146,7 @@ namespace hex::script::loader {
|
||||
hostfxr_set_runtime_property_value(ctx, STRING("PINVOKE_OVERRIDE"), hex::format("{}", (void*)pInvokeOverride).c_str());
|
||||
#endif
|
||||
|
||||
hostfxr_set_error_writer([] HOSTFXR_CALLTYPE (const char_t *message) {
|
||||
hostfxr_set_error_writer([](const char_t *message) {
|
||||
#if defined(OS_WINDOWS)
|
||||
log::error("{}", utf16ToUtf8(message));
|
||||
#else
|
||||
|
@ -102,7 +102,7 @@ SCRIPT_API(void registerProvider, const char *typeName, const char *name, Script
|
||||
auto typeNameString = std::string(typeName);
|
||||
auto nameString = std::string(name);
|
||||
|
||||
hex::ContentRegistry::Provider::impl::add(typeNameString, [typeNameString, nameString, readFunc, writeFunc, getSizeFunc] -> std::unique_ptr<hex::prv::Provider> {
|
||||
hex::ContentRegistry::Provider::impl::add(typeNameString, [typeNameString, nameString, readFunc, writeFunc, getSizeFunc]() -> std::unique_ptr<hex::prv::Provider> {
|
||||
auto provider = std::make_unique<ScriptDataProvider>();
|
||||
provider->setTypeName(typeNameString);
|
||||
provider->setName(nameString);
|
||||
|
Loading…
x
Reference in New Issue
Block a user