fix: Further MSVC compile fixes
This commit is contained in:
parent
8d1352ddff
commit
3f6b5203ca
@ -570,7 +570,7 @@ endmacro()
|
|||||||
macro(setupCompilerFlags target)
|
macro(setupCompilerFlags target)
|
||||||
# IMHEX_COMMON_FLAGS: flags common for C, C++, Objective C, etc.. compilers
|
# 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
|
# Define strict compilation flags
|
||||||
if (IMHEX_STRICT_WARNINGS)
|
if (IMHEX_STRICT_WARNINGS)
|
||||||
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -Wall -Wextra -Wpedantic -Werror")
|
set(IMHEX_COMMON_FLAGS "${IMHEX_COMMON_FLAGS} -Wall -Wextra -Wpedantic -Werror")
|
||||||
@ -584,6 +584,8 @@ macro(setupCompilerFlags target)
|
|||||||
|
|
||||||
# Disable some warnings
|
# Disable some warnings
|
||||||
set(IMHEX_C_CXX_FLAGS "-Wno-array-bounds -Wno-deprecated-declarations -Wno-unknown-pragmas")
|
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()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
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 {
|
add(impl::Entry {
|
||||||
unlocalizedCategory,
|
unlocalizedCategory,
|
||||||
unlocalizedName,
|
unlocalizedName,
|
||||||
[=, ...args = std::forward<Args>(args)] mutable {
|
[=, ...args = std::forward<Args>(args)]() mutable {
|
||||||
auto node = std::make_unique<T>(std::forward<Args>(args)...);
|
auto node = std::make_unique<T>(std::forward<Args>(args)...);
|
||||||
node->setUnlocalizedName(unlocalizedName);
|
node->setUnlocalizedName(unlocalizedName);
|
||||||
return node;
|
return node;
|
||||||
@ -1002,7 +1002,7 @@ namespace hex {
|
|||||||
void add(bool addToList = true) {
|
void add(bool addToList = true) {
|
||||||
auto typeName = T().getTypeName();
|
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>();
|
return std::make_unique<T>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace hex::dp {
|
|||||||
const i128& Node::getIntegerOnInput(u32 index) {
|
const i128& Node::getIntegerOnInput(u32 index) {
|
||||||
auto attribute = this->getConnectedInputAttribute(index);
|
auto attribute = this->getConnectedInputAttribute(index);
|
||||||
|
|
||||||
auto &outputData = [&] -> std::vector<u8>& {
|
auto &outputData = [&]() -> std::vector<u8>&{
|
||||||
if (attribute != nullptr) {
|
if (attribute != nullptr) {
|
||||||
if (attribute->getType() != Attribute::Type::Integer)
|
if (attribute->getType() != Attribute::Type::Integer)
|
||||||
throwNodeError("Tried to read integer from non-integer attribute");
|
throwNodeError("Tried to read integer from non-integer attribute");
|
||||||
@ -68,7 +68,7 @@ namespace hex::dp {
|
|||||||
const double& Node::getFloatOnInput(u32 index) {
|
const double& Node::getFloatOnInput(u32 index) {
|
||||||
auto attribute = this->getConnectedInputAttribute(index);
|
auto attribute = this->getConnectedInputAttribute(index);
|
||||||
|
|
||||||
auto &outputData = [&] -> std::vector<u8>& {
|
auto &outputData = [&]() -> std::vector<u8>&{
|
||||||
if (attribute != nullptr) {
|
if (attribute != nullptr) {
|
||||||
if (attribute->getType() != Attribute::Type::Float)
|
if (attribute->getType() != Attribute::Type::Float)
|
||||||
throwNodeError("Tried to read integer from non-float attribute");
|
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)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(imgui)
|
project(imgui)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
add_library(imgui_all_includes INTERFACE)
|
add_library(imgui_all_includes INTERFACE)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
# https://github.com/BalazsJako/ImGuiColorTextEdit
|
# https://github.com/BalazsJako/ImGuiColorTextEdit
|
||||||
project(imgui_color_text_editor)
|
project(imgui_color_text_editor)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_color_text_editor OBJECT
|
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
|
# https://github.com/ocornut/imgui backends with custom modifications made to the OpenGL 3 and GLFW backends
|
||||||
project(imgui_backend)
|
project(imgui_backend)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_backend OBJECT
|
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
|
# https://github.com/cimgui/cimgui
|
||||||
project(imgui_cimgui)
|
project(imgui_cimgui)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_cimgui OBJECT
|
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
|
# https://github.com/ocornut/imgui
|
||||||
project(imgui_imgui)
|
project(imgui_imgui)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_imgui OBJECT
|
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
|
# https://github.com/Nelarius/imnodes
|
||||||
project(imgui_imnodes)
|
project(imgui_imnodes)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_imnodes OBJECT
|
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
|
# https://github.com/epezent/implot
|
||||||
project(imgui_implot)
|
project(imgui_implot)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_implot OBJECT
|
add_library(imgui_implot OBJECT
|
||||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
# https://github.com/brenocq/implot3d
|
# https://github.com/brenocq/implot3d
|
||||||
project(imgui_implot3d)
|
project(imgui_implot3d)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
add_library(imgui_implot3d OBJECT
|
add_library(imgui_implot3d OBJECT
|
||||||
|
@ -255,7 +255,7 @@ namespace hex {
|
|||||||
return HTCAPTION;
|
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 (!ImHexApi::System::impl::isWindowResizable()) {
|
||||||
if (result != RegionClient) {
|
if (result != RegionClient) {
|
||||||
|
@ -546,7 +546,7 @@ namespace hex {
|
|||||||
const auto maxWindowPos = ImHexApi::System::getMainWindowPosition() + ImHexApi::System::getMainWindowSize();
|
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) {
|
if (currWindowPos.x > maxWindowPos.x || currWindowPos.y > maxWindowPos.y || currWindowPos.x < minWindowPos.x || currWindowPos.y < minWindowPos.y) {
|
||||||
positionSet = false;
|
positionSet = false;
|
||||||
GImGui->MovingWindow = nullptr;
|
ImGui::GetCurrentContext()->MovingWindow = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,7 +1142,7 @@ namespace hex {
|
|||||||
Duration requestedFrameTime = {}, remainingUnlockedTime = {};
|
Duration requestedFrameTime = {}, remainingUnlockedTime = {};
|
||||||
float targetFps = 0;
|
float targetFps = 0;
|
||||||
|
|
||||||
const auto nativeFps = [] -> float {
|
const auto nativeFps = []() -> float {
|
||||||
if (const auto monitor = glfwGetPrimaryMonitor(); monitor != nullptr) {
|
if (const auto monitor = glfwGetPrimaryMonitor(); monitor != nullptr) {
|
||||||
if (const auto videoMode = glfwGetVideoMode(monitor); videoMode != nullptr) {
|
if (const auto videoMode = glfwGetVideoMode(monitor); videoMode != nullptr) {
|
||||||
return videoMode->refreshRate;
|
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));
|
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;
|
offset += m_sectorSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace hex::plugin::builtin {
|
|||||||
class FPSWidget : public ContentRegistry::Settings::Widgets::Widget {
|
class FPSWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||||
public:
|
public:
|
||||||
bool draw(const std::string &name) override {
|
bool draw(const std::string &name) override {
|
||||||
auto format = [this] -> std::string {
|
auto format = [this]() -> std::string {
|
||||||
if (m_value > 200)
|
if (m_value > 200)
|
||||||
return "hex.builtin.setting.interface.fps.unlocked"_lang;
|
return "hex.builtin.setting.interface.fps.unlocked"_lang;
|
||||||
else if (m_value < 15)
|
else if (m_value < 15)
|
||||||
@ -177,7 +177,7 @@ namespace hex::plugin::builtin {
|
|||||||
class ScalingWidget : public ContentRegistry::Settings::Widgets::Widget {
|
class ScalingWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||||
public:
|
public:
|
||||||
bool draw(const std::string &name) override {
|
bool draw(const std::string &name) override {
|
||||||
auto format = [this] -> std::string {
|
auto format = [this]() -> std::string {
|
||||||
if (m_value == 0)
|
if (m_value == 0)
|
||||||
return hex::format("{} (x{:.1f})", "hex.builtin.setting.interface.scaling.native"_lang, ImHexApi::System::getNativeScale());
|
return hex::format("{} (x{:.1f})", "hex.builtin.setting.interface.scaling.native"_lang, ImHexApi::System::getNativeScale());
|
||||||
else
|
else
|
||||||
@ -219,7 +219,7 @@ namespace hex::plugin::builtin {
|
|||||||
class AutoBackupWidget : public ContentRegistry::Settings::Widgets::Widget {
|
class AutoBackupWidget : public ContentRegistry::Settings::Widgets::Widget {
|
||||||
public:
|
public:
|
||||||
bool draw(const std::string &name) override {
|
bool draw(const std::string &name) override {
|
||||||
auto format = [this] -> std::string {
|
auto format = [this]() -> std::string {
|
||||||
auto value = m_value * 30;
|
auto value = m_value * 30;
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return "hex.ui.common.off"_lang;
|
return "hex.ui.common.off"_lang;
|
||||||
|
@ -203,11 +203,11 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
ThemeManager::addThemeHandler("imhex", ImHexColorMap,
|
ThemeManager::addThemeHandler("imhex", ImHexColorMap,
|
||||||
[](u32 colorId) -> ImColor {
|
[](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) {
|
[](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));
|
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 = [] {
|
const static auto ColorTable = [] {
|
||||||
auto colorMap = nlohmann::json::parse(romfs::get("assets/common/color_names.json").string()).get<std::map<std::string, std::string>>();
|
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 {
|
} else {
|
||||||
/* Gutmann's method. Secure for magnetic storage */
|
/* Gutmann's method. Secure for magnetic storage */
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
std::uniform_int_distribution<u8> dist(0x00, 0xFF);
|
std::uniform_int_distribution<u16> dist(0x00, 0xFF);
|
||||||
|
|
||||||
/* Fill fixed patterns */
|
/* Fill fixed patterns */
|
||||||
overwritePattern = {
|
overwritePattern = {
|
||||||
@ -111,9 +111,9 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
/* Fill random patterns */
|
/* Fill random patterns */
|
||||||
for (u8 i = 0; i < 4; i++)
|
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++)
|
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();
|
size_t fileSize = file.getSize();
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <wolv/math_eval/math_evaluator.hpp>
|
#include <wolv/math_eval/math_evaluator.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <implot.h>
|
#include <implot.h>
|
||||||
#include <hex/ui/imgui_imhex_extensions.h>
|
#include <hex/ui/imgui_imhex_extensions.h>
|
||||||
|
@ -86,7 +86,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name = Lang(this->getUnlocalizedName());
|
std::string m_name = Lang(this->getUnlocalizedName()).get();
|
||||||
int m_type = 0;
|
int m_type = 0;
|
||||||
|
|
||||||
std::variant<i128, long double, std::vector<u8>> m_value;
|
std::variant<i128, long double, std::vector<u8>> m_value;
|
||||||
@ -156,7 +156,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name = Lang(this->getUnlocalizedName());
|
std::string m_name = Lang(this->getUnlocalizedName()).get();
|
||||||
int m_type = 0;
|
int m_type = 0;
|
||||||
|
|
||||||
std::variant<i128, long double, std::vector<u8>> m_value;
|
std::variant<i128, long double, std::vector<u8>> m_value;
|
||||||
@ -344,7 +344,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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;
|
bool m_editable = false;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ namespace hex::plugin::builtin {
|
|||||||
reader.seek(searchRegion.getStartAddress());
|
reader.seek(searchRegion.getStartAddress());
|
||||||
reader.setEndAddress(searchRegion.getEndAddress());
|
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)
|
if (settings.type == ASCII)
|
||||||
return { Occurrence::DecodeType::ASCII, std::endian::native };
|
return { Occurrence::DecodeType::ASCII, std::endian::native };
|
||||||
if (settings.type == UTF8)
|
if (settings.type == UTF8)
|
||||||
@ -344,7 +344,7 @@ namespace hex::plugin::builtin {
|
|||||||
auto occurrence = reader.begin();
|
auto occurrence = reader.begin();
|
||||||
u64 progress = 0;
|
u64 progress = 0;
|
||||||
|
|
||||||
auto searchPredicate = [&] -> bool(*)(u8, u8) {
|
auto searchPredicate = [&]() -> bool(*)(u8, u8) {
|
||||||
if (!settings.ignoreCase)
|
if (!settings.ignoreCase)
|
||||||
return [](u8 left, u8 right) -> bool {
|
return [](u8 left, u8 right) -> bool {
|
||||||
return left == right;
|
return left == right;
|
||||||
|
@ -1200,7 +1200,7 @@ namespace hex::plugin::builtin {
|
|||||||
auto encoding = EncodingFile(EncodingFile::Type::Thingy, path);
|
auto encoding = EncodingFile(EncodingFile::Type::Thingy, path);
|
||||||
ImHexApi::Provider::markDirty();
|
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));
|
m_hexEditor.setCustomEncoding(std::move(encoding));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -327,7 +327,7 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
|
if (ImHexApi::Provider::isValid() && provider->isAvailable()) {
|
||||||
static float height = 0;
|
static float height = 0;
|
||||||
static bool dragging = false;
|
static bool dragging = false;
|
||||||
const ImGuiContext& g = *GImGui;
|
const ImGuiContext& g = *ImGui::GetCurrentContext();
|
||||||
if (g.CurrentWindow->Appearing)
|
if (g.CurrentWindow->Appearing)
|
||||||
return;
|
return;
|
||||||
const auto availableSize = g.CurrentWindow->Size;
|
const auto availableSize = g.CurrentWindow->Size;
|
||||||
@ -1292,7 +1292,7 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGuiExt::DimmedIconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
if (ImGuiExt::DimmedIconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||||
auto dataProvider = std::make_shared<prv::MemoryProvider>(section.data);
|
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> {
|
hexEditor.setBackgroundHighlightCallback([this, id, &runtime](u64 address, const u8 *, size_t) -> std::optional<color_t> {
|
||||||
if (m_runningEvaluators != 0)
|
if (m_runningEvaluators != 0)
|
||||||
@ -1318,14 +1318,14 @@ namespace hex::plugin::builtin {
|
|||||||
auto patternProvider = ImHexApi::Provider::get();
|
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.setProvider(dataProvider.get());
|
||||||
hexEditor.draw(480_scaled);
|
hexEditor.draw(480_scaled);
|
||||||
patternDrawer->setSelectionCallback([&](const pl::ptrn::Pattern *pattern) {
|
patternDrawer->setSelectionCallback([&](const pl::ptrn::Pattern *pattern) {
|
||||||
hexEditor.setSelection(Region { pattern->getOffset(), pattern->getSize() });
|
hexEditor.setSelection(Region { pattern->getOffset(), pattern->getSize() });
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto &patterns = [&, this] -> const auto& {
|
const auto &patterns = [&, this]() -> const auto& {
|
||||||
if (patternProvider->isReadable() && *m_executionDone) {
|
if (patternProvider->isReadable() && *m_executionDone) {
|
||||||
return runtime.getPatterns(id);
|
return runtime.getPatterns(id);
|
||||||
} else {
|
} else {
|
||||||
@ -1556,7 +1556,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
// Format: [ AA BB CC DD ] @ 0x12345678
|
// Format: [ AA BB CC DD ] @ 0x12345678
|
||||||
runtime.addPragma("magic", [provider, &foundCorrectType](pl::PatternLanguage &, const std::string &value) -> bool {
|
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);
|
value = wolv::util::trim(value);
|
||||||
|
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
@ -1577,7 +1577,7 @@ namespace hex::plugin::builtin {
|
|||||||
return BinaryPattern(value);
|
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);
|
value = wolv::util::trim(value);
|
||||||
|
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
|
@ -111,7 +111,7 @@ namespace hex::script::loader {
|
|||||||
= getExport<hostfxr_set_error_writer_fn>(hostfxrLibrary, "hostfxr_set_error_writer");
|
= 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
|
return
|
||||||
hostfxr_initialize_for_runtime_config != nullptr &&
|
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());
|
hostfxr_set_runtime_property_value(ctx, STRING("PINVOKE_OVERRIDE"), hex::format("{}", (void*)pInvokeOverride).c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hostfxr_set_error_writer([] HOSTFXR_CALLTYPE (const char_t *message) {
|
hostfxr_set_error_writer([](const char_t *message) {
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
log::error("{}", utf16ToUtf8(message));
|
log::error("{}", utf16ToUtf8(message));
|
||||||
#else
|
#else
|
||||||
|
@ -102,7 +102,7 @@ SCRIPT_API(void registerProvider, const char *typeName, const char *name, Script
|
|||||||
auto typeNameString = std::string(typeName);
|
auto typeNameString = std::string(typeName);
|
||||||
auto nameString = std::string(name);
|
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>();
|
auto provider = std::make_unique<ScriptDataProvider>();
|
||||||
provider->setTypeName(typeNameString);
|
provider->setTypeName(typeNameString);
|
||||||
provider->setName(nameString);
|
provider->setName(nameString);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user