mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-29 00:10:02 -05:00
feat: Added command line interface support (#1172)
System design has been discussed on discord Should fix #948 --------- Co-authored-by: WerWolv <werwolv98@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ namespace hex {
|
||||
this->m_getCompatibleVersionFunction = getPluginFunction<GetCompatibleVersionFunc>("getCompatibleVersion");
|
||||
this->m_setImGuiContextFunction = getPluginFunction<SetImGuiContextFunc>("setImGuiContext");
|
||||
this->m_isBuiltinPluginFunction = getPluginFunction<IsBuiltinPluginFunc>("isBuiltinPlugin");
|
||||
this->m_getSubCommandsFunction = getPluginFunction<GetSubCommandsFunc>("getSubCommands");
|
||||
}
|
||||
|
||||
Plugin::Plugin(Plugin &&other) noexcept {
|
||||
@@ -48,6 +49,7 @@ namespace hex {
|
||||
this->m_getCompatibleVersionFunction = other.m_getCompatibleVersionFunction;
|
||||
this->m_setImGuiContextFunction = other.m_setImGuiContextFunction;
|
||||
this->m_isBuiltinPluginFunction = other.m_isBuiltinPluginFunction;
|
||||
this->m_getSubCommandsFunction = other.m_getSubCommandsFunction;
|
||||
|
||||
other.m_handle = nullptr;
|
||||
other.m_initializePluginFunction = nullptr;
|
||||
@@ -57,6 +59,7 @@ namespace hex {
|
||||
other.m_getCompatibleVersionFunction = nullptr;
|
||||
other.m_setImGuiContextFunction = nullptr;
|
||||
other.m_isBuiltinPluginFunction = nullptr;
|
||||
other.m_getSubCommandsFunction = nullptr;
|
||||
}
|
||||
|
||||
Plugin::~Plugin() {
|
||||
@@ -141,6 +144,14 @@ namespace hex {
|
||||
return this->m_initialized;
|
||||
}
|
||||
|
||||
std::span<SubCommand> Plugin::getSubCommands() const {
|
||||
if (this->m_getSubCommandsFunction != nullptr) {
|
||||
auto result = this->m_getSubCommandsFunction();
|
||||
return { result->subCommands, result->size };
|
||||
} else
|
||||
return { };
|
||||
}
|
||||
|
||||
|
||||
void *Plugin::getPluginFunction(const std::string &symbol) {
|
||||
#if defined(OS_WINDOWS)
|
||||
|
||||
Reference in New Issue
Block a user