1
0
mirror of synced 2025-01-18 09:04:52 +01:00

Refactored libimhex to and includes to better represent it as library

This commit is contained in:
WerWolv 2021-01-13 17:28:27 +01:00
parent 00648c9673
commit eb066b3539
65 changed files with 148 additions and 146 deletions

View File

@ -46,9 +46,9 @@
#include <stdio.h> // sprintf, scanf #include <stdio.h> // sprintf, scanf
#include <stdint.h> // uint8_t, etc. #include <stdint.h> // uint8_t, etc.
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "views/view.hpp" #include <hex/views/view.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
#define _PRISizeT "I" #define _PRISizeT "I"

View File

@ -2,8 +2,8 @@
#include <hex.hpp> #include <hex.hpp>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <string_view> #include <string_view>

View File

@ -5,7 +5,7 @@
#include <string_view> #include <string_view>
#include "patches.hpp" #include "patches.hpp"
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
namespace hex { namespace hex {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <string_view> #include <string_view>

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <vector> #include <vector>
#include <list> #include <list>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
namespace hex { namespace hex {

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <hex.hpp> #include <hex.hpp>
#include <hex/views/view.hpp>
#include "imgui.h" #include <imgui.h>
#include "views/view.hpp" #include <hex/lang/pattern_data.hpp>
#include "lang/pattern_data.hpp"
#include <vector> #include <vector>
#include <tuple> #include <tuple>

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <helpers/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <bit> #include <bit>
#include <cstdio> #include <cstdio>

View File

@ -1,7 +1,8 @@
#pragma once #pragma once
#include <hex/views/view.hpp>
#include "helpers/disassembler.hpp" #include "helpers/disassembler.hpp"
#include "views/view.hpp"
#include <capstone/capstone.h> #include <capstone/capstone.h>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <cstdio> #include <cstdio>

View File

@ -2,9 +2,9 @@
#include <hex.hpp> #include <hex.hpp>
#include "imgui.h" #include <imgui.h>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
#include <vector> #include <vector>
#include <tuple> #include <tuple>

View File

@ -1,17 +1,17 @@
#pragma once #pragma once
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "imgui_memory_editor.h" #include <imgui_memory_editor.h>
#include "ImGuiFileBrowser.h" #include <ImGuiFileBrowser.h>
#include <list> #include <list>
#include <tuple> #include <tuple>
#include <random> #include <random>
#include <vector> #include <vector>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
namespace hex { namespace hex {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <array> #include <array>
#include <cstdio> #include <cstdio>

View File

@ -2,8 +2,8 @@
#include <hex.hpp> #include <hex.hpp>
#include "imgui.h" #include <imgui.h>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <optional> #include <optional>

View File

@ -1,17 +1,17 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
#include "lang/evaluator.hpp" #include <hex/lang/evaluator.hpp>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include <thread> #include <thread>
#include "ImGuiFileBrowser.h" #include <ImGuiFileBrowser.h>
#include "TextEditor.h" #include <TextEditor.h>
namespace hex { namespace hex {

View File

@ -2,9 +2,9 @@
#include <hex.hpp> #include <hex.hpp>
#include "imgui.h" #include <imgui.h>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
#include <vector> #include <vector>
#include <tuple> #include <tuple>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <cstdio> #include <cstdio>
#include <string> #include <string>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <cstdio> #include <cstdio>
#include <string> #include <string>

View File

@ -2,8 +2,8 @@
#include <hex.hpp> #include <hex.hpp>
#include "imgui.h" #include <imgui.h>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "helpers/math_evaluator.hpp" #include "helpers/math_evaluator.hpp"
#include <array> #include <array>

View File

@ -4,8 +4,8 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "views/view.hpp" #include <hex/views/view.hpp>
struct GLFWwindow; struct GLFWwindow;
struct ImGuiSettingsHandler; struct ImGuiSettingsHandler;

View File

@ -1,6 +1,6 @@
#include <plugin.hpp> #include <hex/plugin.hpp>
#include <views/view.hpp> #include <hex/views/view.hpp>
class ViewExample : public hex::View { class ViewExample : public hex::View {
public: public:

View File

@ -16,9 +16,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "")
add_library(libimhex SHARED add_library(libimhex SHARED
source/helpers/event.cpp source/api/event.cpp
source/api/content_registry.cpp
source/helpers/utils.cpp source/helpers/utils.cpp
source/helpers/content_registry.cpp
source/helpers/shared_data.cpp source/helpers/shared_data.cpp
source/lang/preprocessor.cpp source/lang/preprocessor.cpp

View File

@ -5,9 +5,9 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <helpers/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <helpers/event.hpp> #include <hex/api/event.hpp>
#include <views/view.hpp> #include <hex/views/view.hpp>
#include <imgui.h> #include <imgui.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>

View File

@ -2,10 +2,10 @@
#include <hex.hpp> #include <hex.hpp>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
#include "ast_node.hpp" #include <hex/lang/ast_node.hpp>
#include <bit> #include <bit>
#include <string> #include <string>

View File

@ -5,7 +5,7 @@
#include "token.hpp" #include "token.hpp"
#include "ast_node.hpp" #include "ast_node.hpp"
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <unordered_map> #include <unordered_map>
#include <stdexcept> #include <stdexcept>

View File

@ -4,10 +4,10 @@
#include <imgui.h> #include <imgui.h>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "lang/token.hpp" #include <hex/lang/token.hpp>
#include "views/view.hpp" #include <hex/views/view.hpp>
#include <cstring> #include <cstring>
#include <random> #include <random>

View File

@ -2,7 +2,7 @@
#include <hex.hpp> #include <hex.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <utility> #include <utility>
#include <string> #include <string>

View File

@ -4,10 +4,10 @@
#include <imgui.h> #include <imgui.h>
#include <hex.hpp> #include <hex.hpp>
#include <views/view.hpp> #include <hex/api/content_registry.hpp>
#include <providers/provider.hpp> #include <hex/views/view.hpp>
#include <helpers/shared_data.hpp> #include <hex/providers/provider.hpp>
#include <helpers/content_registry.hpp> #include <hex/helpers/shared_data.hpp>
#define IMHEX_PLUGIN_SETUP namespace hex::plugin::internal { \ #define IMHEX_PLUGIN_SETUP namespace hex::plugin::internal { \
void initializePlugin(); \ void initializePlugin(); \

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <helpers/shared_data.hpp> #include <hex/helpers/shared_data.hpp>
namespace hex::prv { namespace hex::prv {

View File

@ -2,9 +2,9 @@
#include <hex.hpp> #include <hex.hpp>
#include "imgui.h" #include <imgui.h>
#include "helpers/event.hpp" #include <hex/api/event.hpp>
#include <functional> #include <functional>
#include <string> #include <string>

View File

@ -1,6 +1,6 @@
#include <helpers/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <helpers/shared_data.hpp> #include <hex/helpers/shared_data.hpp>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>

View File

@ -1,6 +1,6 @@
#include "helpers/event.hpp" #include <hex/api/event.hpp>
#include <helpers/shared_data.hpp> #include <hex/helpers/shared_data.hpp>
namespace hex { namespace hex {

View File

@ -1,4 +1,4 @@
#include <helpers/shared_data.hpp> #include <hex/helpers/shared_data.hpp>
namespace hex { namespace hex {

View File

@ -1,4 +1,4 @@
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <cstdio> #include <cstdio>
#include <codecvt> #include <codecvt>

View File

@ -1,5 +1,5 @@
#include "lang/evaluator.hpp" #include <hex/lang/evaluator.hpp>
#include "helpers/content_registry.hpp" #include <hex/api/content_registry.hpp>
namespace hex::lang { namespace hex::lang {

View File

@ -1,8 +1,8 @@
#include "lang/evaluator.hpp" #include <hex/lang/evaluator.hpp>
#include "lang/token.hpp" #include <hex/lang/token.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "helpers/content_registry.hpp" #include <hex/api/content_registry.hpp>
#include <bit> #include <bit>
#include <algorithm> #include <algorithm>

View File

@ -1,4 +1,4 @@
#include "lang/lexer.hpp" #include <hex/lang/lexer.hpp>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>

View File

@ -1,4 +1,4 @@
#include "lang/parser.hpp" #include <hex/lang/parser.hpp>
#include <optional> #include <optional>
#include <variant> #include <variant>

View File

@ -1,4 +1,4 @@
#include "lang/preprocessor.hpp" #include <hex/lang/preprocessor.hpp>
namespace hex::lang { namespace hex::lang {

View File

@ -1,9 +1,9 @@
#include "lang/validator.hpp" #include <hex/lang/validator.hpp>
#include <unordered_set> #include <unordered_set>
#include <string> #include <string>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
namespace hex::lang { namespace hex::lang {

View File

@ -1,4 +1,4 @@
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <hex.hpp> #include <hex.hpp>

View File

@ -1,12 +1,12 @@
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "imgui.h" #include <imgui.h>
#include <functional> #include <functional>
#include <string> #include <string>
#include <vector> #include <vector>
#include <helpers/shared_data.hpp> #include <hex/helpers/shared_data.hpp>
namespace hex { namespace hex {

View File

@ -1,6 +1,6 @@
#include "helpers/crypto.hpp" #include "helpers/crypto.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <openssl/md4.h> #include <openssl/md4.h>
#include <openssl/md5.h> #include <openssl/md5.h>

View File

@ -1,8 +1,8 @@
#include "helpers/loader_script_handler.hpp" #include "helpers/loader_script_handler.hpp"
#include "views/view.hpp" #include <hex/views/view.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>

View File

@ -4,7 +4,7 @@
#include <string_view> #include <string_view>
#include <type_traits> #include <type_traits>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
namespace hex { namespace hex {

View File

@ -1,10 +1,10 @@
#include "helpers/utils.hpp"
#include "window.hpp" #include "window.hpp"
#include <helpers/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/lang/pattern_data.hpp>
#include <hex/helpers/utils.hpp>
#include "lang/pattern_data.hpp"
#include "views/view_hexeditor.hpp" #include "views/view_hexeditor.hpp"
#include "views/view_pattern.hpp" #include "views/view_pattern.hpp"
#include "views/view_pattern_data.hpp" #include "views/view_pattern_data.hpp"
@ -20,34 +20,35 @@
#include "views/view_command_palette.hpp" #include "views/view_command_palette.hpp"
#include "views/view_settings.hpp" #include "views/view_settings.hpp"
#include <vector> #include <vector>
int main(int argc, char **argv) { int main(int argc, char **argv) {
hex::Window window(argc, argv); using namespace hex;
Window window(argc, argv);
// Shared Data // Shared Data
std::vector<hex::lang::PatternData*> patternData; std::vector<lang::PatternData*> patternData;
std::list<hex::Bookmark> bookmarks; std::list<Bookmark> bookmarks;
// Create views // Create views
hex::ContentRegistry::Views::add<hex::ViewHexEditor>(patternData, bookmarks); ContentRegistry::Views::add<ViewHexEditor>(patternData, bookmarks);
hex::ContentRegistry::Views::add<hex::ViewPattern>(patternData); ContentRegistry::Views::add<ViewPattern>(patternData);
hex::ContentRegistry::Views::add<hex::ViewPatternData>(patternData); ContentRegistry::Views::add<ViewPatternData>(patternData);
hex::ContentRegistry::Views::add<hex::ViewDataInspector>(); ContentRegistry::Views::add<ViewDataInspector>();
hex::ContentRegistry::Views::add<hex::ViewHashes>(); ContentRegistry::Views::add<ViewHashes>();
hex::ContentRegistry::Views::add<hex::ViewInformation>(); ContentRegistry::Views::add<ViewInformation>();
hex::ContentRegistry::Views::add<hex::ViewStrings>(); ContentRegistry::Views::add<ViewStrings>();
hex::ContentRegistry::Views::add<hex::ViewDisassembler>(); ContentRegistry::Views::add<ViewDisassembler>();
hex::ContentRegistry::Views::add<hex::ViewBookmarks>(bookmarks); ContentRegistry::Views::add<ViewBookmarks>(bookmarks);
hex::ContentRegistry::Views::add<hex::ViewPatches>(); ContentRegistry::Views::add<ViewPatches>();
hex::ContentRegistry::Views::add<hex::ViewTools>(); ContentRegistry::Views::add<ViewTools>();
hex::ContentRegistry::Views::add<hex::ViewCommandPalette>(); ContentRegistry::Views::add<ViewCommandPalette>();
hex::ContentRegistry::Views::add<hex::ViewHelp>(); ContentRegistry::Views::add<ViewHelp>();
hex::ContentRegistry::Views::add<hex::ViewSettings>(); ContentRegistry::Views::add<ViewSettings>();
if (argc > 1) if (argc > 1)
hex::View::postEvent(hex::Events::FileDropped, argv[1]); View::postEvent(Events::FileDropped, argv[1]);
window.initPlugins(); window.initPlugins();
window.loop(); window.loop();

View File

@ -1,6 +1,6 @@
#include "views/view_bookmarks.hpp" #include "views/view_bookmarks.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/project_file_handler.hpp" #include "helpers/project_file_handler.hpp"
#include <cstring> #include <cstring>

View File

@ -1,7 +1,7 @@
#include "views/view_data_inspector.hpp" #include "views/view_data_inspector.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <cstring> #include <cstring>

View File

@ -1,7 +1,7 @@
#include "views/view_disassembler.hpp" #include "views/view_disassembler.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <cstring> #include <cstring>

View File

@ -1,12 +1,12 @@
#include "views/view_hashes.hpp" #include "views/view_hashes.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <hex/helpers/utils.hpp>
#include "helpers/crypto.hpp" #include "helpers/crypto.hpp"
#include <vector> #include <vector>
#include "helpers/utils.hpp"
namespace hex { namespace hex {

View File

@ -1,6 +1,6 @@
#include "views/view_hexeditor.hpp" #include "views/view_hexeditor.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "providers/file_provider.hpp" #include "providers/file_provider.hpp"
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>

View File

@ -1,8 +1,7 @@
#include "views/view_information.hpp" #include "views/view_information.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <hex/helpers/utils.hpp>
#include "helpers/utils.hpp"
#include <cstring> #include <cstring>
#include <cmath> #include <cmath>

View File

@ -1,8 +1,8 @@
#include "views/view_patches.hpp" #include "views/view_patches.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include "helpers/project_file_handler.hpp" #include "helpers/project_file_handler.hpp"
#include <string> #include <string>

View File

@ -1,13 +1,13 @@
#include "views/view_pattern.hpp" #include "views/view_pattern.hpp"
#include "lang/preprocessor.hpp" #include <hex/lang/preprocessor.hpp>
#include "lang/parser.hpp" #include <hex/lang/parser.hpp>
#include "lang/lexer.hpp" #include <hex/lang/lexer.hpp>
#include "lang/validator.hpp" #include <hex/lang/validator.hpp>
#include "lang/evaluator.hpp" #include <hex/lang/evaluator.hpp>
#include "helpers/project_file_handler.hpp" #include "helpers/project_file_handler.hpp"
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <magic.h> #include <magic.h>

View File

@ -1,7 +1,7 @@
#include "views/view_pattern_data.hpp" #include "views/view_pattern_data.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "lang/pattern_data.hpp" #include <hex/lang/pattern_data.hpp>
namespace hex { namespace hex {

View File

@ -1,6 +1,6 @@
#include "views/view_settings.hpp" #include "views/view_settings.hpp"
#include "helpers/content_registry.hpp" #include <hex/api/content_registry.hpp>
namespace hex { namespace hex {

View File

@ -1,7 +1,7 @@
#include "views/view_strings.hpp" #include "views/view_strings.hpp"
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include "helpers/utils.hpp" #include <hex/helpers/utils.hpp>
#include <cstring> #include <cstring>

View File

@ -4,9 +4,10 @@
#include <regex> #include <regex>
#include <optional> #include <optional>
#include "providers/provider.hpp" #include <hex/providers/provider.hpp>
#include <hex/helpers/utils.hpp>
#include "helpers/plugin_handler.hpp" #include "helpers/plugin_handler.hpp"
#include "helpers/utils.hpp"
#include <llvm/Demangle/Demangle.h> #include <llvm/Demangle/Demangle.h>

View File

@ -1,18 +1,18 @@
#include "window.hpp" #include "window.hpp"
#include <hex.hpp> #include <hex.hpp>
#include <hex/api/content_registry.hpp>
#include <iostream> #include <iostream>
#include <numeric> #include <numeric>
#include "imgui.h" #include <imgui.h>
#include "imgui_internal.h" #include <imgui_internal.h>
#include "imgui_impl_glfw.h" #include <imgui_impl_glfw.h>
#include "imgui_impl_opengl3.h" #include <imgui_impl_opengl3.h>
#include "imgui_freetype.h" #include <imgui_freetype.h>
#include "helpers/plugin_handler.hpp" #include "helpers/plugin_handler.hpp"
#include "helpers/content_registry.hpp"
#include <glad/glad.h> #include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>