impr: Move plugin unload logging to plugins
This commit is contained in:
parent
874bac7de2
commit
301e95b708
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <wolv/utils/string.hpp>
|
#include <wolv/utils/string.hpp>
|
||||||
#include <wolv/utils/preproc.hpp>
|
#include <wolv/utils/preproc.hpp>
|
||||||
|
#include <wolv/utils/guards.hpp>
|
||||||
|
|
||||||
#if defined (IMHEX_STATIC_LINK_PLUGINS)
|
#if defined (IMHEX_STATIC_LINK_PLUGINS)
|
||||||
#define IMHEX_PLUGIN_VISIBILITY_PREFIX static
|
#define IMHEX_PLUGIN_VISIBILITY_PREFIX static
|
||||||
@ -23,9 +24,10 @@
|
|||||||
* Name, Author and Description will be displayed in the in the plugin list on the Welcome screen.
|
* Name, Author and Description will be displayed in the in the plugin list on the Welcome screen.
|
||||||
*/
|
*/
|
||||||
#define IMHEX_PLUGIN_SETUP(name, author, description) IMHEX_PLUGIN_SETUP_IMPL(name, author, description)
|
#define IMHEX_PLUGIN_SETUP(name, author, description) IMHEX_PLUGIN_SETUP_IMPL(name, author, description)
|
||||||
#define IMHEX_LIBRARY_SETUP() IMHEX_LIBRARY_SETUP_IMPL()
|
#define IMHEX_LIBRARY_SETUP(name) IMHEX_LIBRARY_SETUP_IMPL(name)
|
||||||
|
|
||||||
#define IMHEX_LIBRARY_SETUP_IMPL() \
|
#define IMHEX_LIBRARY_SETUP_IMPL(name) \
|
||||||
|
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloading library '{}'", name); } } HANDLER; } \
|
||||||
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary(); \
|
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary(); \
|
||||||
static auto WOLV_TOKEN_CONCAT(libraryInitializer_, IMHEX_PLUGIN_NAME) = [] { \
|
static auto WOLV_TOKEN_CONCAT(libraryInitializer_, IMHEX_PLUGIN_NAME) = [] { \
|
||||||
initializeLibrary(); \
|
initializeLibrary(); \
|
||||||
@ -52,6 +54,7 @@
|
|||||||
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary()
|
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary()
|
||||||
|
|
||||||
#define IMHEX_PLUGIN_SETUP_IMPL(name, author, description) \
|
#define IMHEX_PLUGIN_SETUP_IMPL(name, author, description) \
|
||||||
|
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloading plugin '{}'", name); } } HANDLER; } \
|
||||||
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginName() { return name; } \
|
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginName() { return name; } \
|
||||||
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginAuthor() { return author; } \
|
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginAuthor() { return author; } \
|
||||||
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginDescription() { return description; } \
|
IMHEX_PLUGIN_VISIBILITY_PREFIX const char *getPluginDescription() { return description; } \
|
||||||
|
@ -260,11 +260,6 @@ namespace hex {
|
|||||||
auto &plugins = getPlugins();
|
auto &plugins = getPlugins();
|
||||||
const auto pluginCount = plugins.size();
|
const auto pluginCount = plugins.size();
|
||||||
for (size_t i = 0; i < pluginCount; i++) {
|
for (size_t i = 0; i < pluginCount; i++) {
|
||||||
auto &plugin = plugins[pluginCount - 1 - i];
|
|
||||||
if (plugin.isLoaded()) {
|
|
||||||
log::info("Unloading plugin '{}'", plugin.getPluginName());
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins.pop_back();
|
plugins.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <ui/pattern_drawer.hpp>
|
#include <ui/pattern_drawer.hpp>
|
||||||
#include <ui/widgets.hpp>
|
#include <ui/widgets.hpp>
|
||||||
|
|
||||||
IMHEX_LIBRARY_SETUP() {
|
IMHEX_LIBRARY_SETUP("UI") {
|
||||||
hex::log::debug("Using romfs: '{}'", romfs::name());
|
hex::log::debug("Using romfs: '{}'", romfs::name());
|
||||||
for (auto &path : romfs::list("lang"))
|
for (auto &path : romfs::list("lang"))
|
||||||
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
|
hex::ContentRegistry::Language::addLocalization(nlohmann::json::parse(romfs::get(path).string()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user