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:
iTrooz
2023-07-13 14:08:23 +02:00
committed by GitHub
parent 8c0395bc7c
commit 1ed658bcdc
21 changed files with 636 additions and 143 deletions

View File

@@ -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)