├── conanfile.txt ├── include └── .gitkeep ├── romfs └── .gitkeep ├── .gitignore ├── cmake └── ImHexSDK.cmake ├── source └── example_plugin.cpp ├── README.md ├── .github └── workflows │ └── build.yml └── CMakeLists.txt /conanfile.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /include/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /romfs/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | cmake-build-*/ -------------------------------------------------------------------------------- /cmake/ImHexSDK.cmake: -------------------------------------------------------------------------------- 1 | if (NOT DEFINED ENV{IMHEX_SDK_PATH}) 2 | message(FATAL_ERROR "The IMHEX_SDK_PATH environment variable is not set") 3 | elseif ($ENV{IMHEX_SDK_PATH} STREQUAL "") 4 | message(FATAL_ERROR "The IMHEX_SDK_PATH environment variable is set but empty") 5 | elseif (NOT EXISTS $ENV{IMHEX_SDK_PATH}) 6 | message(FATAL_ERROR "The IMHEX_SDK_PATH environment variable doesn't contain a valid path") 7 | endif() 8 | add_subdirectory($ENV{IMHEX_SDK_PATH} ImHexSDK) 9 | -------------------------------------------------------------------------------- /source/example_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Browse through the headers in lib/libimhex/include/hex/api/ to see what you can do with the API. 4 | // Most important ones are and 5 | 6 | // This is the main entry point of your plugin. The code in the body of this construct will be executed 7 | // when ImHex starts up and loads the plugin. 8 | // The strings in the header are used to display information about the plugin in the UI. 9 | IMHEX_PLUGIN_SETUP("Example Plugin", "Author", "Description") { 10 | // Put your init code here 11 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImHex Plugin Template 2 | 3 | This is the official [ImHex](https://github.com/WerWolv/ImHex) plugin template. To get started, click on the `Use this Template` button! 4 | 5 | ## Usage 6 | 7 | The Plugin basically consists of three parts: The cmake build script, the GitHub Actions CI script and the actual code. 8 | - `.github/workflows`: The CI scripts 9 | - This is the script that will automatically build the plugin for you. Modify this script when you upgrade to a new version of ImHex or when you need to install extra libraries for example 10 | - `CMakeLists.txt`: The cmake build script 11 | - This file defines the build instructions. It's a regular old CMake script with a few extra functions. Refer to the documentation in the file. 12 | - `source/`, `include/`: Your code 13 | - These folders contain all your source code. The `example_plugin.cpp` file contains the entry point for your Plugin 14 | - `romfs/`: Resource files 15 | - ImHex Plugins have access to a system called the `romfs`. All files you place in this folder are bundled into your plugin and you can access them using the `romfs::` functions. 16 | 17 | ## License Information 18 | 19 | The code in this template can be licensed under any license the user chooses to do so. 20 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: [push] 3 | 4 | jobs: 5 | win: 6 | runs-on: windows-2022 7 | name: Windows 8 | defaults: 9 | run: 10 | shell: msys2 {0} 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v3 14 | with: 15 | submodules: recursive 16 | - name: Install SDK 17 | id: install_sdk 18 | uses: WerWolv/imhex-download-sdk@v1.32.2 19 | - name: Build 20 | run: | 21 | mkdir build 22 | cd build 23 | IMHEX_SDK_PATH="${{ steps.install_sdk.outputs.sdk_path }}" \ 24 | cmake -G Ninja \ 25 | -DCMAKE_BUILD_TYPE=Release \ 26 | -DCMAKE_INSTALL_PREFIX="./install" \ 27 | .. 28 | cmake --build . 29 | cmake --install . 30 | - name: Upload Artifact 31 | uses: actions/upload-artifact@v4 32 | with: 33 | name: windows-build 34 | path: build/install 35 | macos: 36 | runs-on: macos-12 37 | name: MacOS 38 | defaults: 39 | run: 40 | shell: bash {0} 41 | steps: 42 | - name: Checkout 43 | uses: actions/checkout@v3 44 | with: 45 | submodules: recursive 46 | - name: Install SDK 47 | id: install_sdk 48 | uses: WerWolv/imhex-download-sdk@v1.32.2 49 | - name: Build 50 | run: | 51 | mkdir build 52 | cd build 53 | CC=$(brew --prefix gcc@12)/bin/gcc-12 \ 54 | CXX=$(brew --prefix gcc@12)/bin/g++-12 \ 55 | OBJC=$(brew --prefix llvm)/bin/clang \ 56 | OBJCXX=$(brew --prefix llvm)/bin/clang++ \ 57 | PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \ 58 | IMHEX_SDK_PATH="${{ steps.install_sdk.outputs.sdk_path }}" \ 59 | cmake \ 60 | -G Ninja \ 61 | -DCMAKE_BUILD_TYPE=Release \ 62 | -DCMAKE_INSTALL_PREFIX="./install" \ 63 | .. 64 | cmake --build . 65 | cmake --install . 66 | - name: Upload Artifact 67 | uses: actions/upload-artifact@v4 68 | with: 69 | name: macos-build 70 | path: build/install -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ImHex Plugin Template 2 | # ===================== 3 | 4 | # This is the official CMake template for making your own ImHex plugins 5 | # To use this template, copy the file into its own directory and modify it to your needs 6 | # For the most part, this is a regular CMake project with some extra functions provided by the ImHex SDK 7 | # 8 | # [NOTE FOR NON-C++ PLUGINS] 9 | # The template is laid out for a C++ plugin, however you can write your plugin in any language you want 10 | # and just make the plugin statically link against your code. The only thing that's required is a .cpp file with 11 | # the IMHEX_PLUGIN_SETUP() macro used in it. This macro is used to setup the plugin and register it with ImHex 12 | # 13 | # [CMAKE FUNCTIONS] 14 | # add_imhex_plugin(): Registers a new plugin 15 | # NAME: The name of the plugin 16 | # IMHEX_VERSION: The ImHex version this plugin is compatible with. If unset, the plugin will be loaded on all versions (this may not work though) 17 | # SOURCES: Source files of the plugin 18 | # INCLUDES: Include directories of the plugin 19 | # LIBRARIES: Libraries to link against 20 | # FEATURES: Optional features that can be enabled or disabled 21 | # LIBRARY_PLUGIN: If set, turns this plugin into a library plugin. Library plugins can be linked against by other plugins 22 | # 23 | # add_romfs_resource(filePath romfsPath): Adds a file to the romfs of the plugin 24 | # The RomFS is a virtual filesystem whose files can be accessed by the plugin using the functions in the `romfs::` namespace 25 | # This function is used to add a single file to the romfs. You can however also simply create a `romfs` directory in your plugin directory and place your files and folders in there 26 | # filePath: The path to the file on the disk 27 | # romfsPath: The path to the file in the romfs 28 | # 29 | # enable_plugin_feature(feature): Enables a plugin feature 30 | # Features are optional parts of the plugin that may or may not be available depending on build settings 31 | # When a feature is enabled, `IMHEX_FEATURE_ENABLED(feature)` will be defined to true. Otherwise, it will be defined to false 32 | # Use the `IMHEX_PLUGIN_FEATURES` macro in the main plugin file to define names to each feature and have them be listed in the plugin list 33 | # feature: The name of the feature to enable 34 | 35 | cmake_minimum_required(VERSION 3.20) 36 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) 37 | project(ImHexPlugin) 38 | 39 | # Include the ImHex SDK 40 | # For this to work, you need to set the IMHEX_SDK_PATH environment variable to the path of the ImHex SDK 41 | # 42 | # On Windows, the SDK is next to the ImHex executable 43 | # On Linux, the SDK is usually in /usr/share/imhex/sdk but this may vary depending on your distribution 44 | # On MacOS, the SDK is located inside of the ImHex.app bundle under ImHex.app/Contents/Resources/sdk 45 | include(ImHexSDK) 46 | 47 | # Register the plugin 48 | # This will configure everything you need to make your plugin work 49 | # Modify the arguments to your needs. Right now it defines a plugin called `example_plugin` 50 | # with a single source file called `example_plugin.cpp` in the `source` directory 51 | # By default you have access to the libimhex library to interact with ImHex 52 | # as well as libwolv, libromfs, libfmt and ImGui, but you can link against any libraries you want 53 | add_imhex_plugin( 54 | NAME 55 | example_plugin 56 | SOURCES 57 | source/example_plugin.cpp 58 | INCLUDES 59 | include 60 | ) 61 | --------------------------------------------------------------------------------