2021-01-20 20:16:24 +01:00
|
|
|
#include <hex/api/imhex_api.hpp>
|
2022-07-02 16:22:38 +02:00
|
|
|
#include <hex/api/content_registry.hpp>
|
2021-01-20 20:16:24 +01:00
|
|
|
|
|
|
|
#include <hex/api/event.hpp>
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/providers/provider.hpp>
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-07-02 16:22:38 +02:00
|
|
|
#include <utility>
|
2021-08-21 15:03:44 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2022-02-17 11:42:56 +01:00
|
|
|
#include <imgui.h>
|
|
|
|
|
2022-07-02 16:22:38 +02:00
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
2022-10-07 10:14:24 +02:00
|
|
|
#if defined(OS_WINDOWS)
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
#include <shellapi.h>
|
|
|
|
#endif
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
namespace hex {
|
|
|
|
|
2021-08-21 13:55:21 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace ImHexApi::HexEditor {
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
Highlighting::Highlighting(Region region, color_t color)
|
|
|
|
: m_region(region), m_color(color) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Tooltip::Tooltip(Region region, std::string value, color_t color) : m_region(region), m_value(std::move(value)), m_color(color) {
|
|
|
|
|
2022-02-16 14:57:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace impl {
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
static std::map<u32, Highlighting> s_backgroundHighlights;
|
|
|
|
std::map<u32, Highlighting> &getBackgroundHighlights() {
|
|
|
|
return s_backgroundHighlights;
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::map<u32, HighlightingFunction> s_backgroundHighlightingFunctions;
|
|
|
|
std::map<u32, HighlightingFunction> &getBackgroundHighlightingFunctions() {
|
|
|
|
return s_backgroundHighlightingFunctions;
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::map<u32, Highlighting> s_foregroundHighlights;
|
|
|
|
std::map<u32, Highlighting> &getForegroundHighlights() {
|
|
|
|
return s_foregroundHighlights;
|
2022-02-16 14:57:13 +01:00
|
|
|
}
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
static std::map<u32, HighlightingFunction> s_foregroundHighlightingFunctions;
|
|
|
|
std::map<u32, HighlightingFunction> &getForegroundHighlightingFunctions() {
|
|
|
|
return s_foregroundHighlightingFunctions;
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::map<u32, Tooltip> s_tooltips;
|
|
|
|
std::map<u32, Tooltip> &getTooltips() {
|
|
|
|
return s_tooltips;
|
|
|
|
}
|
|
|
|
|
|
|
|
static std::map<u32, TooltipFunction> s_tooltipFunctions;
|
|
|
|
std::map<u32, TooltipFunction> &getTooltipFunctions() {
|
|
|
|
return s_tooltipFunctions;
|
2022-02-16 14:57:13 +01:00
|
|
|
}
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-11-08 21:43:22 +01:00
|
|
|
static std::optional<ProviderRegion> s_currentSelection;
|
|
|
|
void setCurrentSelection(std::optional<ProviderRegion> region) {
|
|
|
|
s_currentSelection = region;
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addBackgroundHighlight(const Region ®ion, color_t color) {
|
|
|
|
static u32 id = 0;
|
2022-03-26 16:54:15 +01:00
|
|
|
|
|
|
|
id++;
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
impl::getBackgroundHighlights().insert({
|
|
|
|
id, Highlighting {region, color}
|
2022-02-01 22:09:44 +01:00
|
|
|
});
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-02-04 00:29:47 +01:00
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeBackgroundHighlight(u32 id) {
|
|
|
|
impl::getBackgroundHighlights().erase(id);
|
2022-02-16 14:57:13 +01:00
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
}
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addBackgroundHighlightingProvider(const impl::HighlightingFunction &function) {
|
|
|
|
static u32 id = 0;
|
2022-02-16 14:57:13 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
id++;
|
2022-02-16 14:57:13 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
impl::getBackgroundHighlightingFunctions().insert({ id, function });
|
2022-02-04 00:29:47 +01:00
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
2022-02-16 14:57:13 +01:00
|
|
|
|
|
|
|
return id;
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
void removeBackgroundHighlightingProvider(u32 id) {
|
|
|
|
impl::getBackgroundHighlightingFunctions().erase(id);
|
2022-02-16 14:57:13 +01:00
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
2021-01-20 20:16:24 +01:00
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
u32 addForegroundHighlight(const Region ®ion, color_t color) {
|
|
|
|
static u32 id = 0;
|
|
|
|
|
|
|
|
id++;
|
|
|
|
|
|
|
|
impl::getForegroundHighlights().insert({
|
|
|
|
id, Highlighting {region, color}
|
2022-02-08 18:38:54 +01:00
|
|
|
});
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeForegroundHighlight(u32 id) {
|
|
|
|
impl::getForegroundHighlights().erase(id);
|
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 addForegroundHighlightingProvider(const impl::HighlightingFunction &function) {
|
|
|
|
static u32 id = 0;
|
|
|
|
|
|
|
|
id++;
|
|
|
|
|
|
|
|
impl::getForegroundHighlightingFunctions().insert({ id, function });
|
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeForegroundHighlightingProvider(u32 id) {
|
|
|
|
impl::getForegroundHighlightingFunctions().erase(id);
|
|
|
|
|
|
|
|
EventManager::post<EventHighlightingChanged>();
|
|
|
|
}
|
|
|
|
|
|
|
|
static u32 tooltipId = 0;
|
|
|
|
u32 addTooltip(Region region, std::string value, color_t color) {
|
|
|
|
tooltipId++;
|
|
|
|
impl::getTooltips().insert({ tooltipId, { region, std::move(value), color } });
|
|
|
|
|
|
|
|
return tooltipId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeTooltip(u32 id) {
|
|
|
|
impl::getTooltips().erase(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static u32 tooltipFunctionId;
|
|
|
|
u32 addTooltipProvider(TooltipFunction function) {
|
|
|
|
tooltipFunctionId++;
|
|
|
|
impl::getTooltipFunctions().insert({ tooltipFunctionId, std::move(function) });
|
|
|
|
|
|
|
|
return tooltipFunctionId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeTooltipProvider(u32 id) {
|
|
|
|
impl::getTooltipFunctions().erase(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isSelectionValid() {
|
|
|
|
return getSelection().has_value();
|
|
|
|
}
|
|
|
|
|
2022-11-08 21:43:22 +01:00
|
|
|
std::optional<ProviderRegion> getSelection() {
|
|
|
|
return impl::s_currentSelection;
|
|
|
|
}
|
2022-05-27 20:42:07 +02:00
|
|
|
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(const Region ®ion, prv::Provider *provider) {
|
|
|
|
setSelection(ProviderRegion { region, provider == nullptr ? Provider::get() : provider });
|
2022-02-08 18:38:54 +01:00
|
|
|
}
|
|
|
|
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(const ProviderRegion ®ion) {
|
2022-02-08 18:38:54 +01:00
|
|
|
EventManager::post<RequestSelectionChange>(region);
|
|
|
|
}
|
|
|
|
|
2022-11-08 21:43:22 +01:00
|
|
|
void setSelection(u64 address, size_t size, prv::Provider *provider) {
|
|
|
|
setSelection({ { address, size }, provider == nullptr ? Provider::get() : provider });
|
2022-02-08 18:38:54 +01:00
|
|
|
}
|
|
|
|
|
2021-01-20 20:16:24 +01:00
|
|
|
}
|
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace ImHexApi::Bookmarks {
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
void add(Region region, const std::string &name, const std::string &comment, u32 color) {
|
|
|
|
EventManager::post<RequestAddBookmark>(region, name, comment, color);
|
|
|
|
}
|
2021-09-21 02:29:54 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
void add(u64 address, size_t size, const std::string &name, const std::string &comment, u32 color) {
|
|
|
|
add(Region { address, size }, name, comment, color);
|
|
|
|
}
|
2021-09-21 02:29:54 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-12 00:41:44 +01:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace ImHexApi::Provider {
|
|
|
|
|
2022-09-05 14:16:31 +02:00
|
|
|
static i64 s_currentProvider = -1;
|
2022-02-01 22:09:44 +01:00
|
|
|
static std::vector<prv::Provider *> s_providers;
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2022-08-08 21:23:52 +02:00
|
|
|
namespace impl {
|
|
|
|
|
|
|
|
static prv::Provider *s_closingProvider = nullptr;
|
|
|
|
void resetClosingProvider() {
|
|
|
|
s_closingProvider = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
prv::Provider* getClosingProvider() {
|
|
|
|
return s_closingProvider;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
prv::Provider *get() {
|
|
|
|
if (!ImHexApi::Provider::isValid())
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return s_providers[s_currentProvider];
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<prv::Provider *> &getProviders() {
|
|
|
|
return s_providers;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCurrentProvider(u32 index) {
|
2022-08-17 16:15:36 +02:00
|
|
|
if (TaskManager::getRunningTaskCount() > 0)
|
2022-07-29 11:35:29 +02:00
|
|
|
return;
|
|
|
|
|
2022-07-30 21:25:18 +02:00
|
|
|
if (index < s_providers.size() && s_currentProvider != index) {
|
2022-02-01 22:09:44 +01:00
|
|
|
auto oldProvider = get();
|
2022-02-01 18:09:40 +01:00
|
|
|
s_currentProvider = index;
|
|
|
|
EventManager::post<EventProviderChanged>(oldProvider, get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isValid() {
|
2022-09-17 08:55:18 +02:00
|
|
|
return !s_providers.empty() && s_currentProvider >= 0 && s_currentProvider < i64(s_providers.size());
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2022-08-08 21:23:52 +02:00
|
|
|
void markDirty() {
|
|
|
|
get()->markDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void resetDirty() {
|
|
|
|
for (auto &provider : s_providers)
|
|
|
|
provider->markDirty(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isDirty() {
|
|
|
|
return std::ranges::any_of(s_providers, [](const auto &provider) {
|
|
|
|
return provider->isDirty();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-08-14 10:07:45 +02:00
|
|
|
void add(prv::Provider *provider, bool skipLoadInterface) {
|
2022-08-17 16:15:36 +02:00
|
|
|
if (TaskManager::getRunningTaskCount() > 0)
|
2022-07-29 11:35:29 +02:00
|
|
|
return;
|
|
|
|
|
2022-08-14 10:07:45 +02:00
|
|
|
if (skipLoadInterface)
|
|
|
|
provider->skipLoadInterface();
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
s_providers.push_back(provider);
|
|
|
|
EventManager::post<EventProviderCreated>(provider);
|
2022-07-31 11:09:20 +02:00
|
|
|
|
|
|
|
setCurrentProvider(s_providers.size() - 1);
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2022-08-08 21:23:52 +02:00
|
|
|
void remove(prv::Provider *provider, bool noQuestions) {
|
2022-07-30 22:01:49 +02:00
|
|
|
if (provider == nullptr)
|
|
|
|
return;
|
|
|
|
|
2022-08-17 16:15:36 +02:00
|
|
|
if (TaskManager::getRunningTaskCount() > 0)
|
2022-07-29 11:35:29 +02:00
|
|
|
return;
|
2022-07-30 22:01:49 +02:00
|
|
|
|
2022-08-08 21:23:52 +02:00
|
|
|
if (!noQuestions) {
|
|
|
|
impl::s_closingProvider = provider;
|
|
|
|
|
|
|
|
bool shouldClose = true;
|
|
|
|
EventManager::post<EventProviderClosing>(provider, &shouldClose);
|
|
|
|
if (!shouldClose)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
auto it = std::find(s_providers.begin(), s_providers.end(), provider);
|
2022-07-30 22:01:49 +02:00
|
|
|
if (it == s_providers.end())
|
|
|
|
return;
|
|
|
|
|
2023-01-04 14:24:18 +01:00
|
|
|
if (!s_providers.empty() && it - s_providers.begin() == s_currentProvider)
|
|
|
|
setCurrentProvider(0);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-01-04 14:24:18 +01:00
|
|
|
s_providers.erase(it);
|
2022-08-10 00:11:16 +02:00
|
|
|
if (s_providers.empty())
|
|
|
|
EventManager::post<EventProviderChanged>(provider, nullptr);
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2022-08-20 14:04:12 +02:00
|
|
|
provider->close();
|
2022-09-04 11:16:20 +02:00
|
|
|
EventManager::post<EventProviderClosed>(provider);
|
|
|
|
|
2022-12-27 11:35:20 +01:00
|
|
|
TaskManager::runWhenTasksFinished([provider] {
|
2023-04-11 15:26:18 +02:00
|
|
|
EventManager::post<EventProviderDeleted>(provider);
|
2022-12-27 11:35:20 +01:00
|
|
|
delete provider;
|
|
|
|
});
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2022-08-14 10:07:45 +02:00
|
|
|
prv::Provider* createProvider(const std::string &unlocalizedName, bool skipLoadInterface) {
|
2022-08-06 22:29:59 +02:00
|
|
|
prv::Provider* result = nullptr;
|
2022-08-14 10:07:45 +02:00
|
|
|
EventManager::post<RequestCreateProvider>(unlocalizedName, skipLoadInterface, &result);
|
2022-08-06 22:29:59 +02:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-09-21 02:29:54 +02:00
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
namespace ImHexApi::System {
|
|
|
|
|
|
|
|
namespace impl {
|
|
|
|
|
|
|
|
static ImVec2 s_mainWindowPos;
|
|
|
|
static ImVec2 s_mainWindowSize;
|
|
|
|
void setMainWindowPosition(u32 x, u32 y) {
|
|
|
|
s_mainWindowPos = ImVec2(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setMainWindowSize(u32 width, u32 height) {
|
|
|
|
s_mainWindowSize = ImVec2(width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ImGuiID s_mainDockSpaceId;
|
|
|
|
void setMainDockSpaceId(ImGuiID id) {
|
|
|
|
s_mainDockSpaceId = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-27 20:42:07 +02:00
|
|
|
static float s_globalScale = 1.0;
|
2022-02-01 18:09:40 +01:00
|
|
|
void setGlobalScale(float scale) {
|
|
|
|
s_globalScale = scale;
|
|
|
|
}
|
|
|
|
|
2022-07-29 17:37:30 +02:00
|
|
|
static float s_nativeScale = 1.0;
|
|
|
|
void setNativeScale(float scale) {
|
|
|
|
s_nativeScale = scale;
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
|
|
|
|
static ProgramArguments s_programArguments;
|
|
|
|
void setProgramArguments(int argc, char **argv, char **envp) {
|
|
|
|
s_programArguments.argc = argc;
|
|
|
|
s_programArguments.argv = argv;
|
|
|
|
s_programArguments.envp = envp;
|
|
|
|
}
|
|
|
|
|
2022-02-15 23:07:48 +01:00
|
|
|
static bool s_borderlessWindowMode;
|
|
|
|
void setBorderlessWindowMode(bool enabled) {
|
|
|
|
s_borderlessWindowMode = enabled;
|
|
|
|
}
|
|
|
|
|
2022-07-02 16:22:38 +02:00
|
|
|
static std::fs::path s_customFontPath;
|
|
|
|
void setCustomFontPath(const std::fs::path &path) {
|
|
|
|
s_customFontPath = path;
|
|
|
|
}
|
|
|
|
|
2022-08-16 11:48:37 +02:00
|
|
|
static float s_fontSize = DefaultFontSize;
|
2022-07-02 16:22:38 +02:00
|
|
|
void setFontSize(float size) {
|
|
|
|
s_fontSize = size;
|
|
|
|
}
|
|
|
|
|
2022-07-02 17:53:13 +02:00
|
|
|
static std::string s_gpuVendor;
|
|
|
|
void setGPUVendor(const std::string &vendor) {
|
|
|
|
s_gpuVendor = vendor;
|
|
|
|
}
|
|
|
|
|
2022-08-01 14:51:08 +02:00
|
|
|
static bool s_portableVersion = false;
|
|
|
|
void setPortableVersion(bool enabled) {
|
|
|
|
s_portableVersion = enabled;
|
|
|
|
}
|
|
|
|
|
2022-09-19 16:54:19 +02:00
|
|
|
void addInitArgument(const std::string &key, const std::string &value) {
|
|
|
|
static std::mutex initArgumentsMutex;
|
|
|
|
std::scoped_lock lock(initArgumentsMutex);
|
|
|
|
|
|
|
|
getInitArguments()[key] = value;
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
}
|
|
|
|
|
2023-03-21 15:33:43 +01:00
|
|
|
void closeImHex(bool noQuestions) {
|
|
|
|
EventManager::post<RequestCloseImHex>(noQuestions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void restartImHex() {
|
|
|
|
EventManager::post<RequestRestartImHex>();
|
|
|
|
EventManager::post<RequestCloseImHex>(false);
|
|
|
|
}
|
2022-02-01 18:09:40 +01:00
|
|
|
|
2023-01-14 14:21:16 +01:00
|
|
|
void setTaskBarProgress(TaskProgressState state, TaskProgressType type, u32 progress) {
|
|
|
|
EventManager::post<EventSetTaskBarIconState>(u32(state), u32(type), progress);
|
|
|
|
}
|
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
const ProgramArguments &getProgramArguments() {
|
2022-02-01 18:09:40 +01:00
|
|
|
return impl::s_programArguments;
|
|
|
|
}
|
|
|
|
|
2022-10-07 10:14:24 +02:00
|
|
|
std::optional<std::u8string> getProgramArgument(int index) {
|
|
|
|
if (index >= impl::s_programArguments.argc) {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(OS_WINDOWS)
|
|
|
|
std::wstring wideArg = ::CommandLineToArgvW(::GetCommandLineW(), &impl::s_programArguments.argc)[index];
|
|
|
|
std::string byteArg = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>().to_bytes(wideArg);
|
|
|
|
|
|
|
|
return std::u8string(byteArg.begin(), byteArg.end());
|
|
|
|
#else
|
|
|
|
return std::u8string(reinterpret_cast<const char8_t *>(impl::s_programArguments.argv[index]));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
|
|
|
|
static float s_targetFPS = 60.0F;
|
|
|
|
|
|
|
|
float getTargetFPS() {
|
|
|
|
return s_targetFPS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setTargetFPS(float fps) {
|
|
|
|
s_targetFPS = fps;
|
|
|
|
}
|
|
|
|
|
|
|
|
float getGlobalScale() {
|
|
|
|
return impl::s_globalScale;
|
|
|
|
}
|
|
|
|
|
2022-07-29 17:37:30 +02:00
|
|
|
float getNativeScale() {
|
|
|
|
return impl::s_nativeScale;
|
|
|
|
}
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
|
|
|
|
ImVec2 getMainWindowPosition() {
|
|
|
|
return impl::s_mainWindowPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImVec2 getMainWindowSize() {
|
|
|
|
return impl::s_mainWindowSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiID getMainDockSpaceId() {
|
|
|
|
return impl::s_mainDockSpaceId;
|
|
|
|
}
|
|
|
|
|
2022-02-15 23:07:48 +01:00
|
|
|
bool isBorderlessWindowModeEnabled() {
|
|
|
|
return impl::s_borderlessWindowMode;
|
|
|
|
}
|
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
std::map<std::string, std::string> &getInitArguments() {
|
2022-02-01 18:09:40 +01:00
|
|
|
static std::map<std::string, std::string> initArgs;
|
|
|
|
|
|
|
|
return initArgs;
|
|
|
|
}
|
2022-07-02 16:22:38 +02:00
|
|
|
|
|
|
|
const std::fs::path &getCustomFontPath() {
|
|
|
|
return impl::s_customFontPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
float getFontSize() {
|
|
|
|
return impl::s_fontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool s_systemThemeDetection;
|
|
|
|
|
|
|
|
|
|
|
|
void enableSystemThemeDetection(bool enabled) {
|
|
|
|
s_systemThemeDetection = enabled;
|
|
|
|
|
|
|
|
EventManager::post<EventSettingsChanged>();
|
2022-08-08 11:22:59 +02:00
|
|
|
EventManager::post<EventOSThemeChanged>();
|
2022-07-02 16:22:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool usesSystemThemeDetection() {
|
|
|
|
return s_systemThemeDetection;
|
|
|
|
}
|
2022-07-02 17:53:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
static std::vector<std::fs::path> s_additionalFolderPaths;
|
|
|
|
const std::vector<std::fs::path> &getAdditionalFolderPaths() {
|
|
|
|
return s_additionalFolderPaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setAdditionalFolderPaths(const std::vector<std::fs::path> &paths) {
|
|
|
|
s_additionalFolderPaths = paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const std::string &getGPUVendor() {
|
|
|
|
return impl::s_gpuVendor;
|
|
|
|
}
|
2022-08-01 14:51:08 +02:00
|
|
|
|
|
|
|
bool isPortableVersion() {
|
|
|
|
return impl::s_portableVersion;
|
|
|
|
}
|
2021-12-16 23:48:52 +01:00
|
|
|
}
|
|
|
|
|
2021-12-22 13:16:51 +01:00
|
|
|
}
|