#pragma once #include #include #include #include #include #include #include #include #include #include #include using ImGuiID = unsigned int; struct ImVec2; namespace hex { namespace prv { class Provider; } namespace ImHexApi { namespace Common { void closeImHex(bool noQuestions = false); void restartImHex(); } namespace HexEditor { using TooltipFunction = std::function; class Highlighting { public: Highlighting() = default; Highlighting(Region region, color_t color); [[nodiscard]] const Region &getRegion() const { return this->m_region; } [[nodiscard]] const color_t &getColor() const { return this->m_color; } private: Region m_region = {}; color_t m_color = 0x00; }; class Tooltip { public: Tooltip() = default; Tooltip(Region region, std::string value, color_t color); [[nodiscard]] const Region &getRegion() const { return this->m_region; } [[nodiscard]] const color_t &getColor() const { return this->m_color; } [[nodiscard]] const std::string &getValue() const { return this->m_value; } private: Region m_region = {}; std::string m_value; color_t m_color = 0x00; }; struct ProviderRegion : public Region { prv::Provider *provider; [[nodiscard]] prv::Provider *getProvider() const { return this->provider; } [[nodiscard]] Region getRegion() const { return { this->address, this->size }; } }; namespace impl { using HighlightingFunction = std::function(u64, const u8*, size_t, bool)>; std::map &getBackgroundHighlights(); std::map &getBackgroundHighlightingFunctions(); std::map &getForegroundHighlights(); std::map &getForegroundHighlightingFunctions(); std::map &getTooltips(); std::map &getTooltipFunctions(); void setCurrentSelection(std::optional region); } u32 addBackgroundHighlight(const Region ®ion, color_t color); void removeBackgroundHighlight(u32 id); u32 addForegroundHighlight(const Region ®ion, color_t color); void removeForegroundHighlight(u32 id); u32 addTooltip(Region region, std::string value, color_t color); void removeTooltip(u32 id); u32 addTooltipProvider(TooltipFunction function); void removeTooltipProvider(u32 id); u32 addBackgroundHighlightingProvider(const impl::HighlightingFunction &function); void removeBackgroundHighlightingProvider(u32 id); u32 addForegroundHighlightingProvider(const impl::HighlightingFunction &function); void removeForegroundHighlightingProvider(u32 id); bool isSelectionValid(); std::optional getSelection(); void setSelection(const Region ®ion, prv::Provider *provider = nullptr); void setSelection(const ProviderRegion ®ion); void setSelection(u64 address, size_t size, prv::Provider *provider = nullptr); } namespace Bookmarks { struct Entry { Region region; std::string name; std::string comment; u32 color; bool locked; }; void add(u64 address, size_t size, const std::string &name, const std::string &comment, color_t color = 0x00000000); } namespace Provider { namespace impl { void resetClosingProvider(); prv::Provider* getClosingProvider(); } prv::Provider *get(); const std::vector &getProviders(); void setCurrentProvider(u32 index); bool isValid(); void markDirty(); void resetDirty(); bool isDirty(); void add(prv::Provider *provider, bool skipLoadInterface = false); template T> void add(auto &&...args) { add(new T(std::forward(args)...)); } void remove(prv::Provider *provider, bool noQuestions = false); prv::Provider* createProvider(const std::string &unlocalizedName, bool skipLoadInterface = false); } namespace System { namespace impl { void setMainWindowPosition(u32 x, u32 y); void setMainWindowSize(u32 width, u32 height); void setMainDockSpaceId(ImGuiID id); void setGlobalScale(float scale); void setNativeScale(float scale); void setProgramArguments(int argc, char **argv, char **envp); void setBorderlessWindowMode(bool enabled); void setCustomFontPath(const std::filesystem::path &path); void setFontSize(float size); void setGPUVendor(const std::string &vendor); void setPortableVersion(bool enabled); void addInitArgument(const std::string &key, const std::string &value = { }); } struct ProgramArguments { int argc; char **argv; char **envp; }; enum class TaskProgressState { Reset, Progress, Flash }; enum class TaskProgressType { Normal, Warning, Error }; void setTaskBarProgress(TaskProgressState state, TaskProgressType type, u32 progress); const ProgramArguments &getProgramArguments(); std::optional getProgramArgument(int index); float getTargetFPS(); void setTargetFPS(float fps); float getGlobalScale(); float getNativeScale(); ImVec2 getMainWindowPosition(); ImVec2 getMainWindowSize(); ImGuiID getMainDockSpaceId(); bool isBorderlessWindowModeEnabled(); std::map &getInitArguments(); constexpr static float DefaultFontSize = 13.0; const std::filesystem::path &getCustomFontPath(); float getFontSize(); void enableSystemThemeDetection(bool enabled); bool usesSystemThemeDetection(); const std::vector &getAdditionalFolderPaths(); void setAdditionalFolderPaths(const std::vector &paths); const std::string &getGPUVendor(); bool isPortableVersion(); } } }