2021-01-20 20:16:24 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
2022-02-16 14:57:13 +01:00
|
|
|
#include <optional>
|
2021-09-08 15:18:24 +02:00
|
|
|
#include <string>
|
2022-02-16 14:57:13 +01:00
|
|
|
#include <vector>
|
2022-05-27 20:42:07 +02:00
|
|
|
#include <map>
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2021-12-23 15:11:38 +01:00
|
|
|
#include <hex/api/keybinding.hpp>
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2023-03-17 17:07:39 +01:00
|
|
|
#include <wolv/io/fs.hpp>
|
|
|
|
|
2022-02-17 11:42:56 +01:00
|
|
|
using ImGuiID = unsigned int;
|
|
|
|
struct ImVec2;
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
namespace hex {
|
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
namespace prv {
|
|
|
|
class Provider;
|
|
|
|
}
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2021-10-16 11:37:29 +02:00
|
|
|
namespace ImHexApi {
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/* Functions to query information from the Hex Editor and interact with it */
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace HexEditor {
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
using TooltipFunction = std::function<void(u64, const u8*, size_t)>;
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
class Highlighting {
|
|
|
|
public:
|
|
|
|
Highlighting() = default;
|
2022-05-27 20:42:07 +02:00
|
|
|
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);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
|
|
|
[[nodiscard]] const Region &getRegion() const { return this->m_region; }
|
|
|
|
[[nodiscard]] const color_t &getColor() const { return this->m_color; }
|
2022-05-27 20:42:07 +02:00
|
|
|
[[nodiscard]] const std::string &getValue() const { return this->m_value; }
|
2022-02-01 18:09:40 +01:00
|
|
|
|
|
|
|
private:
|
2022-02-16 14:57:13 +01:00
|
|
|
Region m_region = {};
|
2022-05-27 20:42:07 +02:00
|
|
|
std::string m_value;
|
2022-02-16 14:57:13 +01:00
|
|
|
color_t m_color = 0x00;
|
2022-02-01 18:09:40 +01:00
|
|
|
};
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
struct ProviderRegion : Region {
|
2022-11-08 21:43:22 +01:00
|
|
|
prv::Provider *provider;
|
|
|
|
|
|
|
|
[[nodiscard]] prv::Provider *getProvider() const { return this->provider; }
|
|
|
|
|
|
|
|
[[nodiscard]] Region getRegion() const { return { this->address, this->size }; }
|
|
|
|
};
|
|
|
|
|
2022-02-16 14:57:13 +01:00
|
|
|
namespace impl {
|
|
|
|
|
2022-09-28 15:01:43 +02:00
|
|
|
using HighlightingFunction = std::function<std::optional<color_t>(u64, const u8*, size_t, bool)>;
|
2022-02-16 14:57:13 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
std::map<u32, Highlighting> &getBackgroundHighlights();
|
|
|
|
std::map<u32, HighlightingFunction> &getBackgroundHighlightingFunctions();
|
|
|
|
std::map<u32, Highlighting> &getForegroundHighlights();
|
|
|
|
std::map<u32, HighlightingFunction> &getForegroundHighlightingFunctions();
|
|
|
|
std::map<u32, Tooltip> &getTooltips();
|
|
|
|
std::map<u32, TooltipFunction> &getTooltipFunctions();
|
2022-02-16 14:57:13 +01:00
|
|
|
|
2023-11-10 21:03:31 +01:00
|
|
|
void setCurrentSelection(const std::optional<ProviderRegion> ®ion);
|
2022-02-16 14:57:13 +01:00
|
|
|
}
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Adds a background color highlighting to the Hex Editor
|
|
|
|
* @param region The region to highlight
|
|
|
|
* @param color The color to use for the highlighting
|
|
|
|
* @return Unique ID used to remove the highlighting again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addBackgroundHighlight(const Region ®ion, color_t color);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a background color highlighting from the Hex Editor
|
|
|
|
* @param id The ID of the highlighting to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeBackgroundHighlight(u32 id);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds a foreground color highlighting to the Hex Editor
|
|
|
|
* @param region The region to highlight
|
|
|
|
* @param color The color to use for the highlighting
|
|
|
|
* @return Unique ID used to remove the highlighting again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addForegroundHighlight(const Region ®ion, color_t color);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a foreground color highlighting from the Hex Editor
|
|
|
|
* @param id The ID of the highlighting to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeForegroundHighlight(u32 id);
|
2022-02-16 14:57:13 +01:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Adds a hover tooltip to the Hex Editor
|
|
|
|
* @param region The region to add the tooltip to
|
|
|
|
* @param value Text to display in the tooltip
|
|
|
|
* @param color The color of the tooltip
|
|
|
|
* @return Unique ID used to remove the tooltip again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addTooltip(Region region, std::string value, color_t color);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a hover tooltip from the Hex Editor
|
|
|
|
* @param id The ID of the tooltip to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeTooltip(u32 id);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds a background color highlighting to the Hex Editor using a callback function
|
|
|
|
* @param function Function that draws the highlighting based on the hovered region
|
|
|
|
* @return Unique ID used to remove the highlighting again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addTooltipProvider(TooltipFunction function);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a background color highlighting from the Hex Editor
|
|
|
|
* @param id The ID of the highlighting to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeTooltipProvider(u32 id);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds a background color highlighting to the Hex Editor using a callback function
|
|
|
|
* @param function Function that draws the highlighting based on the hovered region
|
|
|
|
* @return Unique ID used to remove the highlighting again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addBackgroundHighlightingProvider(const impl::HighlightingFunction &function);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a background color highlighting from the Hex Editor
|
|
|
|
* @param id The ID of the highlighting to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeBackgroundHighlightingProvider(u32 id);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Adds a foreground color highlighting to the Hex Editor using a callback function
|
|
|
|
* @param function Function that draws the highlighting based on the hovered region
|
|
|
|
* @return Unique ID used to remove the highlighting again later
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addForegroundHighlightingProvider(const impl::HighlightingFunction &function);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Removes a foreground color highlighting from the Hex Editor
|
|
|
|
* @param id The ID of the highlighting to remove
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeForegroundHighlightingProvider(u32 id);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Checks if there's a valid selection in the Hex Editor right now
|
|
|
|
*/
|
2022-05-27 20:42:07 +02:00
|
|
|
bool isSelectionValid();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
2023-05-12 08:38:07 +02:00
|
|
|
/**
|
|
|
|
* @brief Clears the current selection in the Hex Editor
|
|
|
|
*/
|
|
|
|
void clearSelection();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Gets the current selection in the Hex Editor
|
|
|
|
* @return The current selection
|
|
|
|
*/
|
2022-11-08 21:43:22 +01:00
|
|
|
std::optional<ProviderRegion> getSelection();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the current selection in the Hex Editor
|
|
|
|
* @param region The region to select
|
|
|
|
* @param provider The provider to select the region in
|
|
|
|
*/
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(const Region ®ion, prv::Provider *provider = nullptr);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the current selection in the Hex Editor
|
|
|
|
* @param region The region to select
|
|
|
|
*/
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(const ProviderRegion ®ion);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the current selection in the Hex Editor
|
|
|
|
* @param address The address to select
|
|
|
|
* @param size The size of the selection
|
|
|
|
* @param provider The provider to select the region in
|
|
|
|
*/
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(u64 address, size_t size, prv::Provider *provider = nullptr);
|
2022-02-08 18:38:54 +01:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-08-21 13:55:21 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/* Functions to interact with Bookmarks */
|
2021-10-16 11:37:29 +02:00
|
|
|
namespace Bookmarks {
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
struct Entry {
|
|
|
|
Region region;
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
std::string name;
|
|
|
|
std::string comment;
|
2021-01-20 20:16:24 +01:00
|
|
|
u32 color;
|
2021-02-24 21:42:18 +01:00
|
|
|
bool locked;
|
2021-01-20 20:16:24 +01:00
|
|
|
};
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Adds a new bookmark
|
|
|
|
* @param address The address of the bookmark
|
|
|
|
* @param size The size of the bookmark
|
|
|
|
* @param name The name of the bookmark
|
|
|
|
* @param comment The comment of the bookmark
|
|
|
|
* @param color The color of the bookmark or 0x00 for the default color
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
void add(u64 address, size_t size, const std::string &name, const std::string &comment, color_t color = 0x00000000);
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-08-21 13:55:21 +02:00
|
|
|
|
2023-05-05 22:02:18 +02:00
|
|
|
/**
|
|
|
|
* Helper methods about the providers
|
|
|
|
* @note the "current provider" or "currently selected provider" refers to the currently selected provider in the UI;
|
|
|
|
* the provider the user is actually editing.
|
|
|
|
*/
|
2021-10-16 11:37:29 +02:00
|
|
|
namespace Provider {
|
|
|
|
|
2022-08-08 21:23:52 +02:00
|
|
|
namespace impl {
|
|
|
|
|
|
|
|
void resetClosingProvider();
|
2023-11-07 15:31:54 +01:00
|
|
|
const std::vector<prv::Provider*>& getClosingProviders();
|
2022-08-08 21:23:52 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Gets the currently selected data provider
|
2023-05-05 22:02:18 +02:00
|
|
|
* @return The currently selected data provider, or nullptr is there is none
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2022-01-24 20:53:17 +01:00
|
|
|
prv::Provider *get();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets a list of all currently loaded data providers
|
|
|
|
* @return The currently loaded data providers
|
|
|
|
*/
|
2022-01-24 20:53:17 +01:00
|
|
|
const std::vector<prv::Provider *> &getProviders();
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Sets the currently selected data provider
|
|
|
|
* @param index Index of the provider to select
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
void setCurrentProvider(u32 index);
|
|
|
|
|
2023-09-24 18:04:14 +02:00
|
|
|
/**
|
|
|
|
* @brief Gets the index of the currently selected data provider
|
|
|
|
* @return Index of the selected provider
|
|
|
|
*/
|
|
|
|
i64 getCurrentProviderIndex();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Checks whether the currently selected data provider is valid
|
|
|
|
* @return Whether the currently selected data provider is valid
|
|
|
|
*/
|
2021-10-16 11:37:29 +02:00
|
|
|
bool isValid();
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
2023-05-05 22:02:18 +02:00
|
|
|
* @brief Marks the **currently selected** data provider as dirty
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2022-08-08 21:23:52 +02:00
|
|
|
void markDirty();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
2023-05-05 22:02:18 +02:00
|
|
|
* @brief Marks **all data providers** as clean
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2022-08-08 21:23:52 +02:00
|
|
|
void resetDirty();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
2023-05-05 22:02:18 +02:00
|
|
|
* @brief Checks whether **any of the data providers** is dirty
|
|
|
|
* @return Whether any data provider is dirty
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2022-08-08 21:23:52 +02:00
|
|
|
bool isDirty();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
2023-05-05 22:02:18 +02:00
|
|
|
* @brief Adds a newly created provider to the list of providers, and mark it as the selected one.
|
2023-03-21 15:33:43 +01:00
|
|
|
* @param provider The provider to add
|
2023-05-05 22:02:18 +02:00
|
|
|
* @param skipLoadInterface Whether to skip the provider's loading interface (see property documentation)
|
2023-06-08 17:02:16 +02:00
|
|
|
* @param select Whether to select the provider after adding it
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2023-06-08 17:02:16 +02:00
|
|
|
void add(prv::Provider *provider, bool skipLoadInterface = false, bool select = true);
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Creates a new provider and adds it to the list of providers
|
|
|
|
* @tparam T The type of the provider to create
|
|
|
|
* @param args Arguments to pass to the provider's constructor
|
|
|
|
*/
|
2022-06-25 12:19:59 +02:00
|
|
|
template<std::derived_from<prv::Provider> T>
|
2022-01-24 20:53:17 +01:00
|
|
|
void add(auto &&...args) {
|
2021-09-21 02:29:54 +02:00
|
|
|
add(new T(std::forward<decltype(args)>(args)...));
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Removes a provider from the list of providers
|
|
|
|
* @param provider The provider to remove
|
|
|
|
* @param noQuestions Whether to skip asking the user for confirmation
|
|
|
|
*/
|
2022-08-08 21:23:52 +02:00
|
|
|
void remove(prv::Provider *provider, bool noQuestions = false);
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
2023-05-05 22:02:18 +02:00
|
|
|
* @brief Creates a new provider using its unlocalized name and add it to the list of providers
|
2023-03-21 15:33:43 +01:00
|
|
|
* @param unlocalizedName The unlocalized name of the provider to create
|
2023-05-05 22:02:18 +02:00
|
|
|
* @param skipLoadInterface Whether to skip the provider's loading interface (see property documentation)
|
2023-11-10 20:47:08 +01:00
|
|
|
* @param select Whether to select the provider after adding it
|
2023-03-21 15:33:43 +01:00
|
|
|
*/
|
2023-06-08 17:02:16 +02:00
|
|
|
prv::Provider* createProvider(const std::string &unlocalizedName, bool skipLoadInterface = false, bool select = true);
|
2022-08-06 22:29:59 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-12-16 23:48:52 +01:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/* Functions to interact with various ImHex system settings */
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace System {
|
|
|
|
|
2023-07-13 14:08:23 +02:00
|
|
|
bool isMainInstance();
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace impl {
|
2023-07-13 14:08:23 +02:00
|
|
|
void setMainInstanceStatus(bool status);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-06-10 15:15:38 +02:00
|
|
|
void setMainWindowPosition(i32 x, i32 y);
|
2022-02-01 18:09:40 +01:00
|
|
|
void setMainWindowSize(u32 width, u32 height);
|
|
|
|
void setMainDockSpaceId(ImGuiID id);
|
|
|
|
|
|
|
|
void setGlobalScale(float scale);
|
2022-07-29 17:37:30 +02:00
|
|
|
void setNativeScale(float scale);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2022-02-15 23:07:48 +01:00
|
|
|
void setBorderlessWindowMode(bool enabled);
|
2022-07-02 16:22:38 +02:00
|
|
|
|
2023-03-17 11:43:50 +01:00
|
|
|
void setCustomFontPath(const std::fs::path &path);
|
2022-07-02 16:22:38 +02:00
|
|
|
void setFontSize(float size);
|
2022-07-02 17:53:13 +02:00
|
|
|
|
|
|
|
void setGPUVendor(const std::string &vendor);
|
2022-08-01 14:51:08 +02:00
|
|
|
|
|
|
|
void setPortableVersion(bool enabled);
|
2022-09-19 16:54:19 +02:00
|
|
|
|
|
|
|
void addInitArgument(const std::string &key, const std::string &value = { });
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ProgramArguments {
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
char **envp;
|
|
|
|
};
|
|
|
|
|
2023-01-14 14:21:16 +01:00
|
|
|
enum class TaskProgressState {
|
|
|
|
Reset,
|
|
|
|
Progress,
|
|
|
|
Flash
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class TaskProgressType {
|
|
|
|
Normal,
|
|
|
|
Warning,
|
|
|
|
Error
|
|
|
|
};
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Closes ImHex
|
|
|
|
* @param noQuestions Whether to skip asking the user for confirmation
|
|
|
|
*/
|
|
|
|
void closeImHex(bool noQuestions = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Restarts ImHex
|
|
|
|
*/
|
|
|
|
void restartImHex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the progress bar in the task bar
|
|
|
|
* @param state The state of the progress bar
|
|
|
|
* @param type The type of the progress bar progress
|
|
|
|
* @param progress The progress of the progress bar
|
|
|
|
*/
|
2023-01-14 14:21:16 +01:00
|
|
|
void setTaskBarProgress(TaskProgressState state, TaskProgressType type, u32 progress);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current target FPS
|
|
|
|
* @return The current target FPS
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
float getTargetFPS();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the target FPS
|
|
|
|
* @param fps The target FPS
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
void setTargetFPS(float fps);
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current global scale
|
|
|
|
* @return The current global scale
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
float getGlobalScale();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current native scale
|
|
|
|
* @return The current native scale
|
|
|
|
*/
|
2022-07-29 17:37:30 +02:00
|
|
|
float getNativeScale();
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current main window position
|
|
|
|
* @return Position of the main window
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
ImVec2 getMainWindowPosition();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current main window size
|
|
|
|
* @return Size of the main window
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
ImVec2 getMainWindowSize();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current main dock space ID
|
|
|
|
* @return ID of the main dock space
|
|
|
|
*/
|
2022-02-01 18:09:40 +01:00
|
|
|
ImGuiID getMainDockSpaceId();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Checks if borderless window mode is enabled currently
|
|
|
|
* @return Whether borderless window mode is enabled
|
|
|
|
*/
|
2022-02-15 23:07:48 +01:00
|
|
|
bool isBorderlessWindowModeEnabled();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Gets the init arguments passed to ImHex from the splash screen
|
|
|
|
* @return Init arguments
|
|
|
|
*/
|
2022-02-01 22:09:44 +01:00
|
|
|
std::map<std::string, std::string> &getInitArguments();
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2022-08-16 11:49:07 +02:00
|
|
|
constexpr static float DefaultFontSize = 13.0;
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current custom font path
|
|
|
|
* @return The current custom font path
|
|
|
|
*/
|
2023-06-30 13:40:16 +02:00
|
|
|
std::filesystem::path &getCustomFontPath();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current font size
|
|
|
|
* @return The current font size
|
|
|
|
*/
|
2022-07-02 16:22:38 +02:00
|
|
|
float getFontSize();
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets if ImHex should follow the system theme
|
|
|
|
* @param enabled Whether to follow the system theme
|
|
|
|
*/
|
2022-07-02 16:22:38 +02:00
|
|
|
void enableSystemThemeDetection(bool enabled);
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Checks if ImHex follows the system theme
|
|
|
|
* @return Whether ImHex follows the system theme
|
|
|
|
*/
|
2022-07-02 16:22:38 +02:00
|
|
|
bool usesSystemThemeDetection();
|
2022-07-02 17:53:13 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the currently set additional folder paths
|
|
|
|
* @return The currently set additional folder paths
|
|
|
|
*/
|
2023-06-30 13:40:16 +02:00
|
|
|
std::vector<std::filesystem::path> &getAdditionalFolderPaths();
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the additional folder paths
|
|
|
|
* @param paths The additional folder paths
|
|
|
|
*/
|
2022-10-21 14:55:01 +02:00
|
|
|
void setAdditionalFolderPaths(const std::vector<std::filesystem::path> &paths);
|
2022-07-02 17:53:13 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current GPU vendor
|
|
|
|
* @return The current GPU vendor
|
|
|
|
*/
|
2022-07-02 17:53:13 +02:00
|
|
|
const std::string &getGPUVendor();
|
2022-08-01 14:51:08 +02:00
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
/**
|
|
|
|
* @brief Checks if ImHex is running in portable mode
|
|
|
|
* @return Whether ImHex is running in portable mode
|
|
|
|
*/
|
2022-08-01 14:51:08 +02:00
|
|
|
bool isPortableVersion();
|
2023-06-20 11:55:56 +02:00
|
|
|
|
2023-06-26 14:01:45 +02:00
|
|
|
/**
|
|
|
|
* @brief Gets the current Operating System name
|
|
|
|
* @return Operating System name
|
|
|
|
*/
|
2023-06-20 11:55:56 +02:00
|
|
|
std::string getOSName();
|
|
|
|
|
2023-06-26 14:01:45 +02:00
|
|
|
/**
|
|
|
|
* @brief Gets the current Operating System version
|
|
|
|
* @return Operating System version
|
|
|
|
*/
|
2023-06-20 11:55:56 +02:00
|
|
|
std::string getOSVersion();
|
|
|
|
|
2023-06-26 14:01:45 +02:00
|
|
|
/**
|
|
|
|
* @brief Gets the current CPU architecture
|
|
|
|
* @return CPU architecture
|
|
|
|
*/
|
2023-06-20 11:55:56 +02:00
|
|
|
std::string getArchitecture();
|
2023-06-26 14:01:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current ImHex version
|
|
|
|
* @return ImHex version
|
|
|
|
*/
|
2023-11-05 19:57:29 +01:00
|
|
|
std::string getImHexVersion(bool withBuildType = true);
|
2023-06-26 14:01:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current git commit hash
|
|
|
|
* @param longHash Whether to return the full hash or the shortened version
|
|
|
|
* @return Git commit hash
|
|
|
|
*/
|
|
|
|
std::string getCommitHash(bool longHash = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the current git commit branch
|
|
|
|
* @return Git commit branch
|
|
|
|
*/
|
|
|
|
std::string getCommitBranch();
|
2023-10-21 20:40:24 +02:00
|
|
|
|
2023-10-22 23:39:14 +02:00
|
|
|
/**
|
|
|
|
* @brief Checks if ImHex was built in debug mode
|
|
|
|
* @return True if ImHex was built in debug mode, false otherwise
|
|
|
|
*/
|
|
|
|
bool isDebugBuild();
|
|
|
|
|
2023-10-21 20:40:24 +02:00
|
|
|
enum class UpdateType {
|
|
|
|
Stable,
|
|
|
|
Nightly
|
|
|
|
};
|
|
|
|
|
|
|
|
bool updateImHex(UpdateType updateType);
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2023-07-13 14:08:23 +02:00
|
|
|
/**
|
|
|
|
* @brief Cross-instance messaging system
|
|
|
|
* This allows you to send messages to the "main" instance of ImHex running, from any other instance
|
|
|
|
*/
|
|
|
|
namespace Messaging {
|
|
|
|
|
|
|
|
namespace impl {
|
|
|
|
using MessagingHandler = std::function<void(const std::vector<u8> &)>;
|
|
|
|
|
|
|
|
std::map<std::string, MessagingHandler> &getHandlers();
|
|
|
|
|
|
|
|
void runHandler(const std::string &eventName, const std::vector<u8> &args);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Register the handler for this specific event name
|
|
|
|
*/
|
|
|
|
void registerHandler(const std::string &eventName, const impl::MessagingHandler &handler);
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-01-20 20:16:24 +01:00
|
|
|
|
|
|
|
}
|