impr: Various small fixes and improvements
This commit is contained in:
parent
e603c75bd3
commit
e6ab2c3b7e
@ -73,6 +73,7 @@ macro(detectOS)
|
|||||||
set(CMAKE_INSTALL_LIBDIR ".")
|
set(CMAKE_INSTALL_LIBDIR ".")
|
||||||
set(PLUGINS_INSTALL_LOCATION "plugins")
|
set(PLUGINS_INSTALL_LOCATION "plugins")
|
||||||
add_compile_definitions(WIN32_LEAN_AND_MEAN)
|
add_compile_definitions(WIN32_LEAN_AND_MEAN)
|
||||||
|
add_compile_definitions(NOMINMAX)
|
||||||
add_compile_definitions(UNICODE)
|
add_compile_definitions(UNICODE)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
add_compile_definitions(OS_MACOS)
|
add_compile_definitions(OS_MACOS)
|
||||||
@ -439,6 +440,8 @@ function(verifyCompiler)
|
|||||||
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
|
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0.0")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0.0")
|
||||||
message(FATAL_ERROR "ImHex requires Clang 17.0.0 or newer. Please use the latest Clang version.")
|
message(FATAL_ERROR "ImHex requires Clang 17.0.0 or newer. Please use the latest Clang version.")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
|
||||||
elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
|
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
|
||||||
endif()
|
endif()
|
||||||
@ -727,7 +730,7 @@ macro(addBundledLibraries)
|
|||||||
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF CACHE BOOL "" FORCE)
|
set(LIBPL_BUILD_CLI_AS_EXECUTABLE OFF CACHE BOOL "" FORCE)
|
||||||
set(LIBPL_ENABLE_PRECOMPILED_HEADERS ${IMHEX_ENABLE_PRECOMPILED_HEADERS} CACHE BOOL "" FORCE)
|
set(LIBPL_ENABLE_PRECOMPILED_HEADERS ${IMHEX_ENABLE_PRECOMPILED_HEADERS} CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32 AND NOT MSVC)
|
||||||
set(LIBPL_SHARED_LIBRARY ON CACHE BOOL "" FORCE)
|
set(LIBPL_SHARED_LIBRARY ON CACHE BOOL "" FORCE)
|
||||||
else()
|
else()
|
||||||
set(LIBPL_SHARED_LIBRARY OFF CACHE BOOL "" FORCE)
|
set(LIBPL_SHARED_LIBRARY OFF CACHE BOOL "" FORCE)
|
||||||
|
@ -40,7 +40,12 @@ IF(MBEDTLS_FOUND)
|
|||||||
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
|
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
|
||||||
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
|
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
|
||||||
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
|
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
SET(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY_FILE}.lib ${MBEDX509_LIBRARY_FILE}.lib ${MBEDCRYPTO_LIBRARY_FILE}.lib)
|
||||||
|
else()
|
||||||
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
|
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
IF(NOT MBEDTLS_FIND_QUIETLY)
|
IF(NOT MBEDTLS_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Found mbedTLS:")
|
MESSAGE(STATUS "Found mbedTLS:")
|
||||||
|
@ -36,8 +36,8 @@ macro(add_imhex_plugin)
|
|||||||
|
|
||||||
# Add include directories and link libraries
|
# Add include directories and link libraries
|
||||||
target_include_directories(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_INCLUDES})
|
target_include_directories(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_INCLUDES})
|
||||||
target_link_libraries(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_LIBRARIES})
|
target_link_libraries(${IMHEX_PLUGIN_NAME} PUBLIC libimhex)
|
||||||
target_link_libraries(${IMHEX_PLUGIN_NAME} PRIVATE libimhex ${FMT_LIBRARIES} imgui_all_includes libwolv)
|
target_link_libraries(${IMHEX_PLUGIN_NAME} PRIVATE ${FMT_LIBRARIES} imgui_all_includes libwolv ${IMHEX_PLUGIN_LIBRARIES})
|
||||||
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl)
|
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl)
|
||||||
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl-gen)
|
addIncludesFromLibrary(${IMHEX_PLUGIN_NAME} libpl-gen)
|
||||||
|
|
||||||
@ -62,7 +62,11 @@ macro(add_imhex_plugin)
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Set rpath of plugin libraries to the plugins folder
|
# Set rpath of plugin libraries to the plugins folder
|
||||||
if (APPLE)
|
if (WIN32)
|
||||||
|
if (IMHEX_PLUGIN_LIBRARY_PLUGIN)
|
||||||
|
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||||
|
endif()
|
||||||
|
elseif (APPLE)
|
||||||
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES BUILD_RPATH "@executable_path/../Frameworks;@executable_path/plugins")
|
set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES BUILD_RPATH "@executable_path/../Frameworks;@executable_path/plugins")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -134,16 +134,22 @@ endif()
|
|||||||
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set_target_properties(libimhex PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
set_target_properties(libimhex PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||||
|
if (NOT MSVC)
|
||||||
target_link_options(libimhex PRIVATE -Wl,--export-all-symbols)
|
target_link_options(libimhex PRIVATE -Wl,--export-all-symbols)
|
||||||
|
endif()
|
||||||
target_link_libraries(libimhex PRIVATE Netapi32.lib)
|
target_link_libraries(libimhex PRIVATE Netapi32.lib)
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
find_library(FOUNDATION NAMES Foundation)
|
find_library(FOUNDATION NAMES Foundation)
|
||||||
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(libimhex PRIVATE microtar libwolv ${NFD_LIBRARIES} magic dl)
|
target_link_libraries(libimhex PRIVATE microtar libwolv ${NFD_LIBRARIES} magic)
|
||||||
target_link_libraries(libimhex PUBLIC libpl ${IMGUI_LIBRARIES} ${JTHREAD_LIBRARIES})
|
target_link_libraries(libimhex PUBLIC libpl ${IMGUI_LIBRARIES} ${JTHREAD_LIBRARIES})
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
target_link_libraries(libimhex PRIVATE dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
precompileHeaders(libimhex "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
precompileHeaders(libimhex "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ namespace hex {
|
|||||||
* @brief Returns all registered achievements
|
* @brief Returns all registered achievements
|
||||||
* @return All achievements
|
* @return All achievements
|
||||||
*/
|
*/
|
||||||
static const std::unordered_map<std::string, std::unordered_map<std::string, std::unique_ptr<Achievement>>>& getAchievements();
|
static const std::unordered_map<UnlocalizedString, std::unordered_map<UnlocalizedString, std::unique_ptr<Achievement>>>& getAchievements();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns all achievement start nodes
|
* @brief Returns all achievement start nodes
|
||||||
@ -370,14 +370,14 @@ namespace hex {
|
|||||||
* @param rebuild Whether to rebuild the list of start nodes
|
* @param rebuild Whether to rebuild the list of start nodes
|
||||||
* @return All achievement start nodes
|
* @return All achievement start nodes
|
||||||
*/
|
*/
|
||||||
static const std::unordered_map<std::string, std::vector<AchievementNode*>>& getAchievementStartNodes(bool rebuild = true);
|
static const std::unordered_map<UnlocalizedString, std::vector<AchievementNode*>>& getAchievementStartNodes(bool rebuild = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns all achievement nodes
|
* @brief Returns all achievement nodes
|
||||||
* @param rebuild Whether to rebuild the list of nodes
|
* @param rebuild Whether to rebuild the list of nodes
|
||||||
* @return All achievement nodes
|
* @return All achievement nodes
|
||||||
*/
|
*/
|
||||||
static const std::unordered_map<std::string, std::list<AchievementNode>>& getAchievementNodes(bool rebuild = true);
|
static const std::unordered_map<UnlocalizedString, std::list<AchievementNode>>& getAchievementNodes(bool rebuild = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads the progress of all achievements from the achievements save file
|
* @brief Loads the progress of all achievements from the achievements save file
|
||||||
|
@ -101,10 +101,9 @@ namespace hex {
|
|||||||
public:
|
public:
|
||||||
UnlocalizedString() = default;
|
UnlocalizedString() = default;
|
||||||
|
|
||||||
template<typename T>
|
UnlocalizedString(const std::string &string) : m_unlocalizedString(string) { }
|
||||||
UnlocalizedString(T &&arg) : m_unlocalizedString(std::forward<T>(arg)) {
|
UnlocalizedString(const char *string) : m_unlocalizedString(string) { }
|
||||||
static_assert(!std::same_as<std::remove_cvref_t<T>, Lang>, "Expected a unlocalized name, got a localized one!");
|
UnlocalizedString(const Lang& arg) = delete;
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] operator std::string() const {
|
[[nodiscard]] operator std::string() const {
|
||||||
return m_unlocalizedString;
|
return m_unlocalizedString;
|
||||||
@ -149,3 +148,10 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct std::hash<hex::UnlocalizedString> {
|
||||||
|
std::size_t operator()(const hex::UnlocalizedString &string) const noexcept {
|
||||||
|
return std::hash<std::string>{}(string.get());
|
||||||
|
}
|
||||||
|
};
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <hex/helpers/fs.hpp>
|
#include <hex/helpers/fs.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace hex::paths {
|
namespace hex::paths {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
#include <opengl_support.h>
|
#include <opengl_support.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
@ -219,7 +220,7 @@ namespace hex::gl {
|
|||||||
this->mat[row*Columns + col] = value;
|
this->mat[row*Columns + col] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
T &operator()( const int &row,const int &col) {
|
T &operator()( const unsigned&row, const unsigned&col) {
|
||||||
return this->mat[row*Columns + col];
|
return this->mat[row*Columns + col];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +402,7 @@ namespace hex::gl {
|
|||||||
T Sx, Cx, Sy, Cy, Sz, Cz;
|
T Sx, Cx, Sy, Cy, Sz, Cz;
|
||||||
Vector<T,3> angles = ypr;
|
Vector<T,3> angles = ypr;
|
||||||
if(!radians)
|
if(!radians)
|
||||||
angles *= M_PI/180;
|
angles *= std::numbers::pi / 180;
|
||||||
|
|
||||||
Sx = -sin(angles[0]); Cx = cos(angles[0]);
|
Sx = -sin(angles[0]); Cx = cos(angles[0]);
|
||||||
Sy = -sin(angles[1]); Cy = cos(angles[1]);
|
Sy = -sin(angles[1]); Cy = cos(angles[1]);
|
||||||
@ -524,7 +525,7 @@ namespace hex::gl {
|
|||||||
Vector<T,3> rotationVector3 = {{rotationVector[0], rotationVector[1], rotationVector[2]}};
|
Vector<T,3> rotationVector3 = {{rotationVector[0], rotationVector[1], rotationVector[2]}};
|
||||||
T theta = rotationVector3.magnitude();
|
T theta = rotationVector3.magnitude();
|
||||||
if (!radians)
|
if (!radians)
|
||||||
theta *= M_PI / 180;
|
theta *= std::numbers::pi / 180;
|
||||||
Vector<T,3> axis = rotationVector3;
|
Vector<T,3> axis = rotationVector3;
|
||||||
if (theta != 0)
|
if (theta != 0)
|
||||||
axis = axis.normalize();
|
axis = axis.normalize();
|
||||||
|
@ -37,7 +37,7 @@ namespace hex {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
[[nodiscard]] std::vector<std::vector<T>> sampleChannels(const std::vector<T> &data, size_t count, size_t channels) {
|
[[nodiscard]] std::vector<std::vector<T>> sampleChannels(const std::vector<T> &data, size_t count, size_t channels) {
|
||||||
if (channels == 0) return {};
|
if (channels == 0) return {};
|
||||||
size_t signalLength = std::max(1.0, double(data.size()) / channels);
|
size_t signalLength = std::max<double>(1.0, double(data.size()) / channels);
|
||||||
|
|
||||||
size_t stride = std::max(1.0, double(signalLength) / count);
|
size_t stride = std::max(1.0, double(signalLength) / count);
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
static AutoReset<std::unordered_map<std::string, std::unordered_map<std::string, std::unique_ptr<Achievement>>>> s_achievements;
|
static AutoReset<std::unordered_map<UnlocalizedString, std::unordered_map<UnlocalizedString, std::unique_ptr<Achievement>>>> s_achievements;
|
||||||
const std::unordered_map<std::string, std::unordered_map<std::string, std::unique_ptr<Achievement>>> &AchievementManager::getAchievements() {
|
const std::unordered_map<UnlocalizedString, std::unordered_map<UnlocalizedString, std::unique_ptr<Achievement>>> &AchievementManager::getAchievements() {
|
||||||
return *s_achievements;
|
return *s_achievements;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AutoReset<std::unordered_map<std::string, std::list<AchievementManager::AchievementNode>>> s_nodeCategoryStorage;
|
static AutoReset<std::unordered_map<UnlocalizedString, std::list<AchievementManager::AchievementNode>>> s_nodeCategoryStorage;
|
||||||
std::unordered_map<std::string, std::list<AchievementManager::AchievementNode>>& getAchievementNodesMutable(bool rebuild) {
|
std::unordered_map<UnlocalizedString, std::list<AchievementManager::AchievementNode>>& getAchievementNodesMutable(bool rebuild) {
|
||||||
if (!s_nodeCategoryStorage->empty() || !rebuild)
|
if (!s_nodeCategoryStorage->empty() || !rebuild)
|
||||||
return s_nodeCategoryStorage;
|
return s_nodeCategoryStorage;
|
||||||
|
|
||||||
@ -36,12 +36,12 @@ namespace hex {
|
|||||||
return s_nodeCategoryStorage;
|
return s_nodeCategoryStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::unordered_map<std::string, std::list<AchievementManager::AchievementNode>>& AchievementManager::getAchievementNodes(bool rebuild) {
|
const std::unordered_map<UnlocalizedString, std::list<AchievementManager::AchievementNode>>& AchievementManager::getAchievementNodes(bool rebuild) {
|
||||||
return getAchievementNodesMutable(rebuild);
|
return getAchievementNodesMutable(rebuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AutoReset<std::unordered_map<std::string, std::vector<AchievementManager::AchievementNode*>>> s_startNodes;
|
static AutoReset<std::unordered_map<UnlocalizedString, std::vector<AchievementManager::AchievementNode*>>> s_startNodes;
|
||||||
const std::unordered_map<std::string, std::vector<AchievementManager::AchievementNode*>>& AchievementManager::getAchievementStartNodes(bool rebuild) {
|
const std::unordered_map<UnlocalizedString, std::vector<AchievementManager::AchievementNode*>>& AchievementManager::getAchievementStartNodes(bool rebuild) {
|
||||||
|
|
||||||
if (!s_startNodes->empty() || !rebuild)
|
if (!s_startNodes->empty() || !rebuild)
|
||||||
return s_startNodes;
|
return s_startNodes;
|
||||||
@ -187,10 +187,10 @@ namespace hex {
|
|||||||
const auto &category = newAchievement->getUnlocalizedCategory();
|
const auto &category = newAchievement->getUnlocalizedCategory();
|
||||||
const auto &name = newAchievement->getUnlocalizedName();
|
const auto &name = newAchievement->getUnlocalizedName();
|
||||||
|
|
||||||
auto [categoryIter, categoryInserted] = s_achievements->insert({ category, std::unordered_map<std::string, std::unique_ptr<Achievement>>{} });
|
auto [categoryIter, categoryInserted] = s_achievements->insert({ category, std::unordered_map<UnlocalizedString, std::unique_ptr<Achievement>>{} });
|
||||||
auto &[categoryKey, achievements] = *categoryIter;
|
auto &[categoryKey, achievements] = *categoryIter;
|
||||||
|
|
||||||
auto [achievementIter, achievementInserted] = achievements.insert({ name, std::move(newAchievement) });
|
auto [achievementIter, achievementInserted] = achievements.emplace(name, std::move(newAchievement));
|
||||||
auto &[achievementKey, achievement] = *achievementIter;
|
auto &[achievementKey, achievement] = *achievementIter;
|
||||||
|
|
||||||
achievementAdded();
|
achievementAdded();
|
||||||
@ -239,7 +239,7 @@ namespace hex {
|
|||||||
|
|
||||||
achievement->setProgress(progress);
|
achievement->setProgress(progress);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
log::warn("Failed to load achievement progress for '{}::{}': {}", categoryName, achievementName, e.what());
|
log::warn("Failed to load achievement progress for '{}::{}': {}", categoryName.get(), achievementName.get(), e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace hex {
|
|||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
struct OnChange {
|
struct OnChange {
|
||||||
u32 id;
|
u64 id;
|
||||||
OnChangeCallback callback;
|
OnChangeCallback callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -714,15 +714,15 @@ namespace hex {
|
|||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
static AutoReset<std::map<std::string, std::unique_ptr<View>>> s_views;
|
static AutoReset<std::map<UnlocalizedString, std::unique_ptr<View>>> s_views;
|
||||||
const std::map<std::string, std::unique_ptr<View>>& getEntries() {
|
const std::map<UnlocalizedString, std::unique_ptr<View>>& getEntries() {
|
||||||
return *s_views;
|
return *s_views;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(std::unique_ptr<View> &&view) {
|
void add(std::unique_ptr<View> &&view) {
|
||||||
log::debug("Registered new view: {}", view->getUnlocalizedName().get());
|
log::debug("Registered new view: {}", view->getUnlocalizedName().get());
|
||||||
|
|
||||||
s_views->insert({ view->getUnlocalizedName(), std::move(view) });
|
s_views->emplace(view->getUnlocalizedName(), std::move(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1126,7 +1126,9 @@ namespace hex {
|
|||||||
|
|
||||||
namespace ContentRegistry::HexEditor {
|
namespace ContentRegistry::HexEditor {
|
||||||
|
|
||||||
const int DataVisualizer::TextInputFlags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_AlwaysOverwrite;
|
int DataVisualizer::DefaultTextInputFlags() {
|
||||||
|
return ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_AlwaysOverwrite;
|
||||||
|
}
|
||||||
|
|
||||||
bool DataVisualizer::drawDefaultScalarEditingTextBox(u64 address, const char *format, ImGuiDataType dataType, u8 *data, ImGuiInputTextFlags flags) const {
|
bool DataVisualizer::drawDefaultScalarEditingTextBox(u64 address, const char *format, ImGuiDataType dataType, u8 *data, ImGuiInputTextFlags flags) const {
|
||||||
struct UserData {
|
struct UserData {
|
||||||
@ -1144,7 +1146,7 @@ namespace hex {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ImGui::PushID(reinterpret_cast<void*>(address));
|
ImGui::PushID(reinterpret_cast<void*>(address));
|
||||||
ImGuiExt::InputScalarCallback("##editing_input", dataType, data, format, flags | TextInputFlags | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
ImGuiExt::InputScalarCallback("##editing_input", dataType, data, format, flags | DefaultTextInputFlags() | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
||||||
auto &userData = *static_cast<UserData*>(data->UserData);
|
auto &userData = *static_cast<UserData*>(data->UserData);
|
||||||
|
|
||||||
if (data->CursorPos >= userData.maxChars)
|
if (data->CursorPos >= userData.maxChars)
|
||||||
@ -1175,7 +1177,7 @@ namespace hex {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ImGui::PushID(reinterpret_cast<void*>(address));
|
ImGui::PushID(reinterpret_cast<void*>(address));
|
||||||
ImGui::InputText("##editing_input", data.data(), data.size() + 1, flags | TextInputFlags | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
ImGui::InputText("##editing_input", data.data(), data.size() + 1, flags | DefaultTextInputFlags() | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
||||||
auto &userData = *static_cast<UserData*>(data->UserData);
|
auto &userData = *static_cast<UserData*>(data->UserData);
|
||||||
|
|
||||||
userData.data->resize(data->BufSize);
|
userData.data->resize(data->BufSize);
|
||||||
|
@ -15,7 +15,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <magic.h>
|
#include <magic.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <direct.h>
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
#define MAGIC_PATH_SEPARATOR ";"
|
#define MAGIC_PATH_SEPARATOR ";"
|
||||||
|
@ -332,7 +332,7 @@ namespace hex::prv {
|
|||||||
else if (category == "description")
|
else if (category == "description")
|
||||||
return magic::getDescription(this);
|
return magic::getDescription(this);
|
||||||
else if (category == "provider_type")
|
else if (category == "provider_type")
|
||||||
return this->getTypeName();
|
return this->getTypeName().get();
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ public:
|
|||||||
void SetLanguageDefinition(const LanguageDefinition& aLanguageDef);
|
void SetLanguageDefinition(const LanguageDefinition& aLanguageDef);
|
||||||
const LanguageDefinition& GetLanguageDefinition() const { return mLanguageDefinition; }
|
const LanguageDefinition& GetLanguageDefinition() const { return mLanguageDefinition; }
|
||||||
|
|
||||||
static const Palette& GetPalette() { return sPaletteBase; }
|
static const Palette& GetPalette();
|
||||||
static void SetPalette(const Palette& aValue);
|
static void SetPalette(const Palette& aValue);
|
||||||
|
|
||||||
void SetErrorMarkers(const ErrorMarkers& aMarkers) { mErrorMarkers = aMarkers; }
|
void SetErrorMarkers(const ErrorMarkers& aMarkers) { mErrorMarkers = aMarkers; }
|
||||||
@ -613,7 +613,6 @@ private:
|
|||||||
bool mIgnoreImGuiChild = false;
|
bool mIgnoreImGuiChild = false;
|
||||||
bool mShowWhitespaces = true;
|
bool mShowWhitespaces = true;
|
||||||
|
|
||||||
static Palette sPaletteBase;
|
|
||||||
Palette mPalette = {};
|
Palette mPalette = {};
|
||||||
LanguageDefinition mLanguageDefinition = {};
|
LanguageDefinition mLanguageDefinition = {};
|
||||||
RegexList mRegexList;
|
RegexList mRegexList;
|
||||||
|
@ -25,7 +25,7 @@ bool equals(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Bi
|
|||||||
const int TextEditor::sCursorBlinkInterval = 1200;
|
const int TextEditor::sCursorBlinkInterval = 1200;
|
||||||
const int TextEditor::sCursorBlinkOnTime = 800;
|
const int TextEditor::sCursorBlinkOnTime = 800;
|
||||||
|
|
||||||
TextEditor::Palette TextEditor::sPaletteBase = TextEditor::GetDarkPalette();
|
TextEditor::Palette sPaletteBase = TextEditor::GetDarkPalette();
|
||||||
|
|
||||||
TextEditor::FindReplaceHandler::FindReplaceHandler() : mWholeWord(false),mFindRegEx(false),mMatchCase(false) {}
|
TextEditor::FindReplaceHandler::FindReplaceHandler() : mWholeWord(false),mFindRegEx(false),mMatchCase(false) {}
|
||||||
|
|
||||||
@ -79,6 +79,8 @@ void TextEditor::SetLanguageDefinition(const LanguageDefinition &aLanguageDef) {
|
|||||||
Colorize();
|
Colorize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TextEditor::Palette& TextEditor::GetPalette() { return sPaletteBase; }
|
||||||
|
|
||||||
void TextEditor::SetPalette(const Palette &aValue) {
|
void TextEditor::SetPalette(const Palette &aValue) {
|
||||||
sPaletteBase = aValue;
|
sPaletteBase = aValue;
|
||||||
}
|
}
|
||||||
|
8
lib/third_party/imgui/backend/CMakeLists.txt
vendored
8
lib/third_party/imgui/backend/CMakeLists.txt
vendored
@ -25,15 +25,17 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
|||||||
set(GLFW_INCLUDE_DIRS ${glfw3_INCLUDE_DIRS})
|
set(GLFW_INCLUDE_DIRS ${glfw3_INCLUDE_DIRS})
|
||||||
set(GLFW_LIBRARIES ${glfw3_LIBRARIES})
|
set(GLFW_LIBRARIES ${glfw3_LIBRARIES})
|
||||||
|
|
||||||
if (NOT glfw3_FOUND OR "${GLFW_LIBRARIES}" STREQUAL "")
|
if (NOT glfw3_FOUND AND "${GLFW_LIBRARIES}" STREQUAL "")
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_search_module(GLFW REQUIRED glfw3)
|
pkg_search_module(GLFW REQUIRED glfw3)
|
||||||
endif ()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("${GLFW_LIBRARIES}" MATCHES ".+dll")
|
if ("${GLFW_LIBRARIES}" MATCHES ".+dll")
|
||||||
set(GLFW_LIBRARIES "glfw3")
|
set(GLFW_LIBRARIES "glfw3")
|
||||||
endif ()
|
endif ()
|
||||||
|
else()
|
||||||
|
set(GLFW_LIBRARIES GLFW::GLFW)
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(imgui_backend PUBLIC ${FREETYPE_INCLUDE_DIRS} ${OpenGL_INCLUDE_DIRS})
|
target_include_directories(imgui_backend PUBLIC ${FREETYPE_INCLUDE_DIRS} ${OpenGL_INCLUDE_DIRS})
|
||||||
target_link_directories(imgui_backend PUBLIC ${FREETYPE_LIBRARY_DIRS} ${OpenGL_LIBRARY_DIRS})
|
target_link_directories(imgui_backend PUBLIC ${FREETYPE_LIBRARY_DIRS} ${OpenGL_LIBRARY_DIRS})
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(WINGDIAPI)
|
||||||
|
#define WINGDIAPI extern "C"
|
||||||
|
#define APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WEB)
|
#if defined(OS_WEB)
|
||||||
#define GLFW_INCLUDE_ES3
|
#define GLFW_INCLUDE_ES3
|
||||||
#include <GLES3/gl3.h>
|
#include <GLES3/gl3.h>
|
||||||
|
@ -113,6 +113,11 @@
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WINGDIAPI)
|
||||||
|
#define WINGDIAPI extern "C"
|
||||||
|
#define APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#ifndef IMGUI_DISABLE
|
#ifndef IMGUI_DISABLE
|
||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
|
@ -56,7 +56,7 @@ namespace hex {
|
|||||||
|
|
||||||
std::map<u64, std::vector<u8>> orderedData;
|
std::map<u64, std::vector<u8>> orderedData;
|
||||||
for (u32 i = 0; i < sequenceCount; i++) {
|
for (u32 i = 0; i < sequenceCount; i++) {
|
||||||
ssize_t offset = random() % size;
|
i64 offset = random() % size;
|
||||||
|
|
||||||
std::vector<u8> sequence;
|
std::vector<u8> sequence;
|
||||||
sequence.resize(std::min<size_t>(sequenceCount, size - offset));
|
sequence.resize(std::min<size_t>(sequenceCount, size - offset));
|
||||||
@ -93,7 +93,7 @@ namespace hex {
|
|||||||
|
|
||||||
std::map<u64, std::vector<u8>> orderedData;
|
std::map<u64, std::vector<u8>> orderedData;
|
||||||
for (u32 i = 0; i < sequenceCount; i++) {
|
for (u32 i = 0; i < sequenceCount; i++) {
|
||||||
ssize_t offset = random() % inputBuffer.size();
|
i64 offset = random() % inputBuffer.size();
|
||||||
|
|
||||||
std::vector<u8> sequence;
|
std::vector<u8> sequence;
|
||||||
sequence.reserve(sampleSize);
|
sequence.reserve(sampleSize);
|
||||||
|
@ -78,7 +78,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void importIPSPatch() {
|
void importIPSPatch() {
|
||||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
|
||||||
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
||||||
auto patch = Patches::fromIPSPatch(patchData);
|
auto patch = Patches::fromIPSPatch(patchData);
|
||||||
if (!patch.has_value()) {
|
if (!patch.has_value()) {
|
||||||
@ -102,7 +102,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void importIPS32Patch() {
|
void importIPS32Patch() {
|
||||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
|
||||||
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
||||||
auto patch = Patches::fromIPS32Patch(patchData);
|
auto patch = Patches::fromIPS32Patch(patchData);
|
||||||
if (!patch.has_value()) {
|
if (!patch.has_value()) {
|
||||||
@ -126,7 +126,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void importModifiedFile() {
|
void importModifiedFile() {
|
||||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void exportBase64() {
|
void exportBase64() {
|
||||||
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &) {
|
||||||
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
|
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
|
||||||
if (!outputFile.isValid()) {
|
if (!outputFile.isValid()) {
|
||||||
TaskManager::doLater([] {
|
TaskManager::doLater([] {
|
||||||
@ -188,7 +188,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
void exportSelectionToFile() {
|
void exportSelectionToFile() {
|
||||||
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [path](auto &task) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
|
||||||
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
|
wolv::io::File outputFile(path, wolv::io::File::Mode::Create);
|
||||||
if (!outputFile.isValid()) {
|
if (!outputFile.isValid()) {
|
||||||
TaskManager::doLater([] {
|
TaskManager::doLater([] {
|
||||||
@ -216,7 +216,7 @@ namespace hex::plugin::builtin {
|
|||||||
for (const auto &formatter : ContentRegistry::DataFormatter::impl::getExportMenuEntries()) {
|
for (const auto &formatter : ContentRegistry::DataFormatter::impl::getExportMenuEntries()) {
|
||||||
if (menu::menuItem(Lang(formatter.unlocalizedName), Shortcut::None, false, ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->getActualSize() > 0)) {
|
if (menu::menuItem(Lang(formatter.unlocalizedName), Shortcut::None, false, ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->getActualSize() > 0)) {
|
||||||
fs::openFileBrowser(fs::DialogMode::Save, {}, [&formatter](const auto &path) {
|
fs::openFileBrowser(fs::DialogMode::Save, {}, [&formatter](const auto &path) {
|
||||||
TaskManager::createTask("hex.builtin.task.exporting_data"_lang, TaskManager::NoProgress, [&formatter, path](auto&){
|
TaskManager::createTask("hex.builtin.task.exporting_data", TaskManager::NoProgress, [&formatter, path](auto&){
|
||||||
auto provider = ImHexApi::Provider::get();
|
auto provider = ImHexApi::Provider::get();
|
||||||
auto selection = ImHexApi::HexEditor::getSelection()
|
auto selection = ImHexApi::HexEditor::getSelection()
|
||||||
.value_or(
|
.value_or(
|
||||||
@ -243,7 +243,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void exportReport() {
|
void exportReport() {
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [](auto &) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [](auto &) {
|
||||||
std::string data;
|
std::string data;
|
||||||
|
|
||||||
for (const auto &provider : ImHexApi::Provider::getProviders()) {
|
for (const auto &provider : ImHexApi::Provider::getProviders()) {
|
||||||
@ -287,7 +287,7 @@ namespace hex::plugin::builtin {
|
|||||||
patches->get().at(0x00454F45) = value;
|
patches->get().at(0x00454F45) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [patches](auto &) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [patches](auto &) {
|
||||||
auto data = patches->toIPSPatch();
|
auto data = patches->toIPSPatch();
|
||||||
|
|
||||||
TaskManager::doLater([data] {
|
TaskManager::doLater([data] {
|
||||||
@ -326,7 +326,7 @@ namespace hex::plugin::builtin {
|
|||||||
patches->get().at(0x45454F45) = value;
|
patches->get().at(0x45454F45) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager::createTask("hex.ui.common.processing"_lang, TaskManager::NoProgress, [patches](auto &) {
|
TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [patches](auto &) {
|
||||||
auto data = patches->toIPS32Patch();
|
auto data = patches->toIPS32Patch();
|
||||||
|
|
||||||
TaskManager::doLater([data] {
|
TaskManager::doLater([data] {
|
||||||
|
@ -63,7 +63,7 @@ namespace hex::plugin::builtin {
|
|||||||
if (!view->shouldStoreWindowState())
|
if (!view->shouldStoreWindowState())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
buffer->appendf("%s=%d\n", name.c_str(), view->getWindowOpenState());
|
buffer->appendf("%s=%d\n", name.get().c_str(), view->getWindowOpenState());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,9 @@ namespace hex::plugin::builtin {
|
|||||||
m_dragStartIterator = tools.end();
|
m_dragStartIterator = tools.end();
|
||||||
|
|
||||||
// Attach the newly created window to the cursor, so it gets dragged around
|
// Attach the newly created window to the cursor, so it gets dragged around
|
||||||
GImGui->MovingWindow = ImGui::GetCurrentWindowRead();
|
auto& g = *ImGui::GetCurrentContext();
|
||||||
GImGui->ActiveId = GImGui->MovingWindow->MoveId;
|
g.MovingWindow = ImGui::GetCurrentWindowRead();
|
||||||
|
g.ActiveId = g.MovingWindow->MoveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto window = ImGui::GetCurrentWindowRead();
|
const auto window = ImGui::GetCurrentWindowRead();
|
||||||
|
@ -8,7 +8,9 @@ if (NOT USE_SYSTEM_CAPSTONE)
|
|||||||
set(CAPSTONE_BUILD_TESTS OFF CACHE BOOL "Disable tests")
|
set(CAPSTONE_BUILD_TESTS OFF CACHE BOOL "Disable tests")
|
||||||
set(CAPSTONE_BUILD_MACOS_THIN ON CACHE BOOL "Enable thin builds of capstone for macOS" FORCE)
|
set(CAPSTONE_BUILD_MACOS_THIN ON CACHE BOOL "Enable thin builds of capstone for macOS" FORCE)
|
||||||
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/capstone ${CMAKE_CURRENT_BINARY_DIR}/capstone EXCLUDE_FROM_ALL)
|
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/capstone ${CMAKE_CURRENT_BINARY_DIR}/capstone EXCLUDE_FROM_ALL)
|
||||||
|
if (NOT MSVC)
|
||||||
target_compile_options(capstone PRIVATE -Wno-unused-function)
|
target_compile_options(capstone PRIVATE -Wno-unused-function)
|
||||||
|
endif()
|
||||||
set(CAPSTONE_LIBRARY "capstone")
|
set(CAPSTONE_LIBRARY "capstone")
|
||||||
set(CAPSTONE_INCLUDE_DIR ${THIRD_PARTY_LIBS_FOLDER}/capstone/include)
|
set(CAPSTONE_INCLUDE_DIR ${THIRD_PARTY_LIBS_FOLDER}/capstone/include)
|
||||||
else()
|
else()
|
||||||
|
@ -47,7 +47,7 @@ namespace hex::plugin::disasm {
|
|||||||
if (m_regionToDisassemble.get(provider).getStartAddress() < m_imageBaseAddress)
|
if (m_regionToDisassemble.get(provider).getStartAddress() < m_imageBaseAddress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_disassemblerTask = TaskManager::createTask("hex.disassembler.view.disassembler.disassembling"_lang, m_regionToDisassemble.get(provider).getSize(), [this, provider](auto &task) {
|
m_disassemblerTask = TaskManager::createTask("hex.disassembler.view.disassembler.disassembling", m_regionToDisassemble.get(provider).getSize(), [this, provider](auto &task) {
|
||||||
const auto &currArchitecture = m_currArchitecture.get(provider);
|
const auto &currArchitecture = m_currArchitecture.get(provider);
|
||||||
const auto region = m_regionToDisassemble.get(provider);
|
const auto region = m_regionToDisassemble.get(provider);
|
||||||
auto &disassembly = m_disassembly.get(provider);
|
auto &disassembly = m_disassembly.get(provider);
|
||||||
|
@ -62,7 +62,7 @@ namespace hex::ui {
|
|||||||
ImGui::PushID(reinterpret_cast<void*>(address));
|
ImGui::PushID(reinterpret_cast<void*>(address));
|
||||||
ON_SCOPE_EXIT { ImGui::PopID(); };
|
ON_SCOPE_EXIT { ImGui::PopID(); };
|
||||||
std::array<char, 2> buffer = { std::isprint(data[0]) != 0 ? char(data[0]) : '.', 0x00 };
|
std::array<char, 2> buffer = { std::isprint(data[0]) != 0 ? char(data[0]) : '.', 0x00 };
|
||||||
ImGui::InputText("##editing_input", buffer.data(), buffer.size(), TextInputFlags | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
ImGui::InputText("##editing_input", buffer.data(), buffer.size(), DefaultTextInputFlags() | ImGuiInputTextFlags_CallbackEdit, [](ImGuiInputTextCallbackData *data) -> int {
|
||||||
auto &userData = *static_cast<UserData*>(data->UserData);
|
auto &userData = *static_cast<UserData*>(data->UserData);
|
||||||
|
|
||||||
if (data->BufTextLen >= userData.maxChars) {
|
if (data->BufTextLen >= userData.maxChars) {
|
||||||
|
@ -1397,7 +1397,7 @@ namespace hex::ui {
|
|||||||
m_filtersUpdated = true;
|
m_filtersUpdated = true;
|
||||||
|
|
||||||
if (!m_favoritesUpdateTask.isRunning()) {
|
if (!m_favoritesUpdateTask.isRunning()) {
|
||||||
m_favoritesUpdateTask = TaskManager::createTask("hex.ui.pattern_drawer.updating"_lang, TaskManager::NoProgress, [this, patterns, runtime](auto &task) {
|
m_favoritesUpdateTask = TaskManager::createTask("hex.ui.pattern_drawer.updating", TaskManager::NoProgress, [this, patterns, runtime](auto &task) {
|
||||||
size_t updatedFavorites = 0;
|
size_t updatedFavorites = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -377,24 +377,24 @@ namespace hex::plugin::visualizers {
|
|||||||
|
|
||||||
|
|
||||||
if ((indexType == IndexType::Undefined || vectors.indices.empty()) && vertexCount % 3 != 0) {
|
if ((indexType == IndexType::Undefined || vectors.indices.empty()) && vertexCount % 3 != 0) {
|
||||||
throw std::runtime_error(std::string("hex.visualizers.pl_visualizer.3d.error_message_vertex_count"_lang));
|
throw std::runtime_error("hex.visualizers.pl_visualizer.3d.error_message_vertex_count"_lang.get());
|
||||||
} else
|
} else
|
||||||
buffers.vertices = gl::Buffer<float>(gl::BufferType::Vertex, vectors.vertices);
|
buffers.vertices = gl::Buffer<float>(gl::BufferType::Vertex, vectors.vertices);
|
||||||
|
|
||||||
|
|
||||||
if (validateVector(vectors.colors, vertexCount, 4, std::string("hex.visualizers.pl_visualizer.3d.error_message_colors"_lang), errorMessage))
|
if (validateVector(vectors.colors, vertexCount, 4, "hex.visualizers.pl_visualizer.3d.error_message_colors"_lang.get(), errorMessage))
|
||||||
buffers.colors = gl::Buffer<float>(gl::BufferType::Vertex, vectors.colors);
|
buffers.colors = gl::Buffer<float>(gl::BufferType::Vertex, vectors.colors);
|
||||||
else {
|
else {
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateVector(vectors.normals, vertexCount, 3, std::string("hex.visualizers.pl_visualizer.3d.error_message_normals"_lang), errorMessage))
|
if (validateVector(vectors.normals, vertexCount, 3, "hex.visualizers.pl_visualizer.3d.error_message_normals"_lang.get(), errorMessage))
|
||||||
buffers.normals = gl::Buffer<float>(gl::BufferType::Vertex, vectors.normals);
|
buffers.normals = gl::Buffer<float>(gl::BufferType::Vertex, vectors.normals);
|
||||||
else {
|
else {
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateVector(vectors.uv, vertexCount, 2, std::string("hex.visualizers.pl_visualizer.3d.error_message_uv_coords"_lang), errorMessage))
|
if (validateVector(vectors.uv, vertexCount, 2, "hex.visualizers.pl_visualizer.3d.error_message_uv_coords"_lang.get(), errorMessage))
|
||||||
buffers.uv = gl::Buffer<float>(gl::BufferType::Vertex, vectors.uv);
|
buffers.uv = gl::Buffer<float>(gl::BufferType::Vertex, vectors.uv);
|
||||||
else {
|
else {
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
@ -430,11 +430,11 @@ namespace hex::plugin::visualizers {
|
|||||||
lineBuffers.indices = gl::Buffer<T>(gl::BufferType::Index, lineVectors.indices);
|
lineBuffers.indices = gl::Buffer<T>(gl::BufferType::Index, lineVectors.indices);
|
||||||
|
|
||||||
if ((indexType == IndexType::Undefined || lineVectors.indices.empty()) && vertexCount % 3 != 0) {
|
if ((indexType == IndexType::Undefined || lineVectors.indices.empty()) && vertexCount % 3 != 0) {
|
||||||
throw std::runtime_error(std::string("hex.visualizers.pl_visualizer.3d.error_message_vertex_count"_lang));
|
throw std::runtime_error("hex.visualizers.pl_visualizer.3d.error_message_vertex_count"_lang.get());
|
||||||
} else
|
} else
|
||||||
lineBuffers.vertices = gl::Buffer<float>(gl::BufferType::Vertex, lineVectors.vertices);
|
lineBuffers.vertices = gl::Buffer<float>(gl::BufferType::Vertex, lineVectors.vertices);
|
||||||
|
|
||||||
if (validateVector(lineVectors.colors, vertexCount, 4, std::string("hex.visualizers.pl_visualizer.3d.error_message_colors"_lang), errorMessage))
|
if (validateVector(lineVectors.colors, vertexCount, 4, "hex.visualizers.pl_visualizer.3d.error_message_colors"_lang.get(), errorMessage))
|
||||||
lineBuffers.colors = gl::Buffer<float>(gl::BufferType::Vertex, lineVectors.colors);
|
lineBuffers.colors = gl::Buffer<float>(gl::BufferType::Vertex, lineVectors.colors);
|
||||||
else {
|
else {
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
@ -644,7 +644,7 @@ namespace hex::plugin::visualizers {
|
|||||||
vectors.vertices = patternToArray<float>(verticesPattern.get());
|
vectors.vertices = patternToArray<float>(verticesPattern.get());
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
s_vertexCount = vectors.vertices.size() / 3;
|
s_vertexCount = vectors.vertices.size() / 3;
|
||||||
if (!validateVector(vectors.vertices, s_vertexCount, 3, std::string("hex.visualizers.pl_visualizer.3d.error_message_positions"_lang), errorMessage))
|
if (!validateVector(vectors.vertices, s_vertexCount, 3, "hex.visualizers.pl_visualizer.3d.error_message_positions"_lang, errorMessage))
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
|
|
||||||
if (s_indexType != IndexType::Undefined) {
|
if (s_indexType != IndexType::Undefined) {
|
||||||
@ -652,16 +652,16 @@ namespace hex::plugin::visualizers {
|
|||||||
s_badIndices.clear();
|
s_badIndices.clear();
|
||||||
auto indexCount = vectors.indices.size();
|
auto indexCount = vectors.indices.size();
|
||||||
if (indexCount < 3 || indexCount % 3 != 0) {
|
if (indexCount < 3 || indexCount % 3 != 0) {
|
||||||
throw std::runtime_error(std::string("hex.visualizers.pl_visualizer.3d.error_message_index_count"_lang));
|
throw std::runtime_error("hex.visualizers.pl_visualizer.3d.error_message_index_count"_lang.get());
|
||||||
}
|
}
|
||||||
auto booleans = std::views::transform(vectors.indices,isIndexInRange);
|
auto booleans = std::views::transform(vectors.indices,isIndexInRange);
|
||||||
if (!std::accumulate(std::begin(booleans), std::end(booleans), true, std::logical_and<>())) {
|
if (!std::accumulate(std::begin(booleans), std::end(booleans), true, std::logical_and<>())) {
|
||||||
errorMessage = std::string("hex.visualizers.pl_visualizer.3d.error_message_invalid_indices"_lang);
|
errorMessage = "hex.visualizers.pl_visualizer.3d.error_message_invalid_indices"_lang.get();
|
||||||
for (auto badIndex : s_badIndices)
|
for (auto badIndex : s_badIndices)
|
||||||
errorMessage += std::to_string(badIndex) + ", ";
|
errorMessage += std::to_string(badIndex) + ", ";
|
||||||
errorMessage.pop_back();
|
errorMessage.pop_back();
|
||||||
errorMessage.pop_back();
|
errorMessage.pop_back();
|
||||||
errorMessage += hex::format(std::string("hex.visualizers.pl_visualizer.3d.error_message_for_vertex_count"_lang),s_vertexCount);
|
errorMessage += hex::format("hex.visualizers.pl_visualizer.3d.error_message_for_vertex_count"_lang.get(), s_vertexCount);
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,23 +682,23 @@ namespace hex::plugin::visualizers {
|
|||||||
|
|
||||||
lineVectors.vertices = patternToArray<float>(verticesPattern.get());
|
lineVectors.vertices = patternToArray<float>(verticesPattern.get());
|
||||||
s_vertexCount = lineVectors.vertices.size() / 3;
|
s_vertexCount = lineVectors.vertices.size() / 3;
|
||||||
if (!validateVector(lineVectors.vertices, s_vertexCount, 3, std::string("hex.visualizers.pl_visualizer.3d.error_message_positions"_lang), errorMessage))
|
if (!validateVector(lineVectors.vertices, s_vertexCount, 3, "hex.visualizers.pl_visualizer.3d.error_message_positions"_lang.get(), errorMessage))
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
|
|
||||||
if (s_indexType != IndexType::Undefined) {
|
if (s_indexType != IndexType::Undefined) {
|
||||||
lineVectors.indices = patternToArray<T>(indicesPattern.get());
|
lineVectors.indices = patternToArray<T>(indicesPattern.get());
|
||||||
auto indexCount = lineVectors.indices.size();
|
auto indexCount = lineVectors.indices.size();
|
||||||
if (indexCount < 3 || indexCount % 3 != 0) {
|
if (indexCount < 3 || indexCount % 3 != 0) {
|
||||||
throw std::runtime_error(std::string("hex.visualizers.pl_visualizer.3d.error_message_index_count"_lang));
|
throw std::runtime_error("hex.visualizers.pl_visualizer.3d.error_message_index_count"_lang.get());
|
||||||
}
|
}
|
||||||
s_badIndices.clear();
|
s_badIndices.clear();
|
||||||
if (!std::ranges::all_of(lineVectors.indices,isIndexInRange)) {
|
if (!std::ranges::all_of(lineVectors.indices,isIndexInRange)) {
|
||||||
errorMessage = std::string("hex.visualizers.pl_visualizer.3d.error_message_invalid_indices"_lang);
|
errorMessage = "hex.visualizers.pl_visualizer.3d.error_message_invalid_indices"_lang.get();
|
||||||
for (auto badIndex : s_badIndices)
|
for (auto badIndex : s_badIndices)
|
||||||
errorMessage += std::to_string(badIndex) + ", ";
|
errorMessage += std::to_string(badIndex) + ", ";
|
||||||
errorMessage.pop_back();
|
errorMessage.pop_back();
|
||||||
errorMessage.pop_back();
|
errorMessage.pop_back();
|
||||||
errorMessage += hex::format(std::string("hex.visualizers.pl_visualizer.3d.error_message_for_vertex_count"_lang),s_vertexCount);
|
errorMessage += hex::format("hex.visualizers.pl_visualizer.3d.error_message_for_vertex_count"_lang.get(), s_vertexCount);
|
||||||
throw std::runtime_error(errorMessage);
|
throw std::runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace hex::plugin::visualizers {
|
|||||||
ImGuiExt::TextSpinner("hex.visualizers.pl_visualizer.coordinates.querying"_lang);
|
ImGuiExt::TextSpinner("hex.visualizers.pl_visualizer.coordinates.querying"_lang);
|
||||||
} else if (address.empty()) {
|
} else if (address.empty()) {
|
||||||
if (ImGuiExt::DimmedButton("hex.visualizers.pl_visualizer.coordinates.query"_lang)) {
|
if (ImGuiExt::DimmedButton("hex.visualizers.pl_visualizer.coordinates.query"_lang)) {
|
||||||
addressTask = TaskManager::createBackgroundTask("hex.visualizers.pl_visualizer.coordinates.querying"_lang, [lat = latitude, lon = longitude](auto &) {
|
addressTask = TaskManager::createBackgroundTask("hex.visualizers.pl_visualizer.coordinates.querying", [lat = latitude, lon = longitude](auto &) {
|
||||||
constexpr static auto ApiURL = "https://geocode.maps.co/reverse?lat={}&lon={}&format=jsonv2";
|
constexpr static auto ApiURL = "https://geocode.maps.co/reverse?lat={}&lon={}&format=jsonv2";
|
||||||
|
|
||||||
HttpRequest request("GET", hex::format(ApiURL, lat, lon));
|
HttpRequest request("GET", hex::format(ApiURL, lat, lon));
|
||||||
@ -90,7 +90,7 @@ namespace hex::plugin::visualizers {
|
|||||||
jsonAddr["country"].get<std::string>());
|
jsonAddr["country"].get<std::string>());
|
||||||
}
|
}
|
||||||
} catch (std::exception &) {
|
} catch (std::exception &) {
|
||||||
address = std::string("hex.visualizers.pl_visualizer.coordinates.querying_no_address"_lang);
|
address = "hex.visualizers.pl_visualizer.coordinates.querying_no_address"_lang.get();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace hex::plugin::visualizers {
|
|||||||
if (shouldReset) {
|
if (shouldReset) {
|
||||||
waveData.clear();
|
waveData.clear();
|
||||||
|
|
||||||
resetTask = TaskManager::createTask("hex.visualizers.pl_visualizer.task.visualizing"_lang, TaskManager::NoProgress, [=](Task &) {
|
resetTask = TaskManager::createTask("hex.visualizers.pl_visualizer.task.visualizing", TaskManager::NoProgress, [=](Task &) {
|
||||||
ma_device_stop(&audioDevice);
|
ma_device_stop(&audioDevice);
|
||||||
waveData = patternToArray<i16>(wavePattern.get());
|
waveData = patternToArray<i16>(wavePattern.get());
|
||||||
if (waveData.empty())
|
if (waveData.empty())
|
||||||
|
@ -250,7 +250,7 @@ namespace hex::plugin::yara {
|
|||||||
if (provider == nullptr)
|
if (provider == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_matcherTask = TaskManager::createTask("hex.yara_rules.view.yara.matching"_lang, 0, [this, provider](auto &task) {
|
m_matcherTask = TaskManager::createTask("hex.yara_rules.view.yara.matching", 0, [this, provider](auto &task) {
|
||||||
std::vector<YaraRule::Result> results;
|
std::vector<YaraRule::Result> results;
|
||||||
for (const auto &[fileName, filePath] : *m_rulePaths) {
|
for (const auto &[fileName, filePath] : *m_rulePaths) {
|
||||||
YaraRule rule(filePath);
|
YaraRule rule(filePath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user