fix: Debug mode only being enabled after everything has been initialized already

This commit is contained in:
WerWolv
2025-01-25 16:54:16 +01:00
parent 048c483903
commit 1eee31fdbb

View File

@@ -85,6 +85,15 @@ IMHEX_PLUGIN_SUBCOMMANDS() {
IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
using namespace hex::plugin::builtin;
// Show a warning banner on debug builds
#if defined(DEBUG)
ui::BannerIcon::open(ICON_VS_ERROR, "You're running a Debug build of ImHex. Performance will be degraded!", ImColor(153, 58, 58));
dbg::setDebugModeEnabled(true);
#else
const auto enabled = ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.debug_mode_enabled", false);
dbg::setDebugModeEnabled(enabled);
#endif
hex::log::debug("Using romfs: '{}'", romfs::name());
for (auto &path : romfs::list("lang"))
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
@@ -132,13 +141,4 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
createWelcomeScreen();
setupOutOfBoxExperience();
// Show a warning banner on debug builds
#if defined(DEBUG)
ui::BannerIcon::open(ICON_VS_ERROR, "You're running a Debug build of ImHex. Performance will be degraded!", ImColor(153, 58, 58));
dbg::setDebugModeEnabled(true);
#else
const auto enabled = ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.debug_mode_enabled", false);
dbg::setDebugModeEnabled(enabled);
#endif
}