mirror of https://github.com/WerWolv/ImHex.git
fix: Subcommands not working at all on Linux
This commit is contained in:
parent
3149183450
commit
e5a793e8de
|
@ -24,11 +24,6 @@ namespace hex {
|
|||
std::function<void(const std::vector<std::string>&)> callback;
|
||||
};
|
||||
|
||||
struct SubCommandList {
|
||||
hex::SubCommand *subCommands;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
class Plugin {
|
||||
public:
|
||||
explicit Plugin(const std::fs::path &path);
|
||||
|
@ -58,7 +53,7 @@ namespace hex {
|
|||
using GetCompatibleVersionFunc = const char *(*)();
|
||||
using SetImGuiContextFunc = void (*)(ImGuiContext *);
|
||||
using IsBuiltinPluginFunc = bool (*)();
|
||||
using GetSubCommandsFunc = SubCommandList* (*)();
|
||||
using GetSubCommandsFunc = void* (*)();
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
HMODULE m_handle = nullptr;
|
||||
|
|
|
@ -39,10 +39,7 @@
|
|||
|
||||
#define IMHEX_PLUGIN_SUBCOMMANDS_IMPL() \
|
||||
extern std::vector<hex::SubCommand> g_subCommands; \
|
||||
extern "C" [[gnu::visibility("default")]] hex::SubCommandList getSubCommands() { \
|
||||
return hex::SubCommandList { \
|
||||
g_subCommands.data(), \
|
||||
g_subCommands.size() \
|
||||
}; \
|
||||
extern "C" [[gnu::visibility("default")]] void* getSubCommands() { \
|
||||
return &g_subCommands; \
|
||||
} \
|
||||
std::vector<hex::SubCommand> g_subCommands
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace hex {
|
|||
std::span<SubCommand> Plugin::getSubCommands() const {
|
||||
if (this->m_getSubCommandsFunction != nullptr) {
|
||||
auto result = this->m_getSubCommandsFunction();
|
||||
return { result->subCommands, result->size };
|
||||
return *reinterpret_cast<std::vector<SubCommand>*>(result);
|
||||
} else
|
||||
return { };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue