mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
ui/api: Added loaded plugin information to welcome screen
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
|
||||
#include <hex/views/view.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <string_view>
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace hex {
|
||||
|
||||
@@ -13,17 +15,33 @@ namespace hex {
|
||||
public:
|
||||
Plugin(std::string_view path);
|
||||
Plugin(const Plugin&) = delete;
|
||||
Plugin(Plugin &&other);
|
||||
Plugin(Plugin &&other) noexcept;
|
||||
~Plugin();
|
||||
|
||||
void initializePlugin() const;
|
||||
std::string getPluginName() const;
|
||||
std::string getPluginAuthor() const;
|
||||
std::string getPluginDescription() const;
|
||||
|
||||
|
||||
private:
|
||||
using InitializePluginFunc = void(*)();
|
||||
using InitializePluginFunc = void(*)();
|
||||
using GetPluginNameFunc = const char*(*)();
|
||||
using GetPluginAuthorFunc = const char*(*)();
|
||||
using GetPluginDescriptionFunc = const char*(*)();
|
||||
|
||||
void *m_handle = nullptr;
|
||||
|
||||
InitializePluginFunc m_initializePluginFunction = nullptr;
|
||||
InitializePluginFunc m_initializePluginFunction = nullptr;
|
||||
GetPluginNameFunc m_getPluginNameFunction = nullptr;
|
||||
GetPluginAuthorFunc m_getPluginAuthorFunction = nullptr;
|
||||
GetPluginDescriptionFunc m_getPluginDescriptionFunction = nullptr;
|
||||
|
||||
template<typename T>
|
||||
auto getPluginFunction(std::string_view pluginName, std::string_view symbol) {
|
||||
auto symbolName = hex::format(symbol.data(), pluginName.length(), pluginName.data());
|
||||
return reinterpret_cast<T>(dlsym(this->m_handle, symbolName.c_str()));
|
||||
};
|
||||
};
|
||||
|
||||
class PluginHandler {
|
||||
|
||||
Reference in New Issue
Block a user