mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-12-23 11:31:49 +01:00
Addned functions to load plugin meta information from a path or buffer
This commit is contained in:
parent
3d642c25d0
commit
a2816cea61
@ -34,13 +34,36 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(co
|
||||
DEBUG_FUNCTION_LINE("Can't find or process ELF file");
|
||||
return std::nullopt;
|
||||
}
|
||||
auto reader = readerOpt.value();
|
||||
return loadPlugin(readerOpt.value());
|
||||
}
|
||||
std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(const std::string filePath) {
|
||||
auto reader = new elfio;
|
||||
if (reader == NULL || !reader->load(filePath)) {
|
||||
DEBUG_FUNCTION_LINE("Can't find or process ELF file\n");
|
||||
delete reader;
|
||||
return std::nullopt;
|
||||
}
|
||||
return loadPlugin(reader);
|
||||
}
|
||||
|
||||
std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(char *buffer, size_t size) {
|
||||
auto reader = new elfio;
|
||||
if (reader == NULL || !reader->load(buffer, size)) {
|
||||
DEBUG_FUNCTION_LINE("Can't find or process ELF file\n");
|
||||
delete reader;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return loadPlugin(reader);
|
||||
}
|
||||
|
||||
std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(elfio *reader) {
|
||||
DEBUG_FUNCTION_LINE("Found elfio reader");
|
||||
|
||||
size_t pluginSize = 0;
|
||||
|
||||
PluginMetaInformation pluginInfo;
|
||||
|
||||
uint32_t sec_num = reader->sections.size();
|
||||
|
||||
DEBUG_FUNCTION_LINE("%d number of sections", sec_num);
|
||||
|
@ -26,4 +26,10 @@
|
||||
class PluginMetaInformationFactory {
|
||||
public:
|
||||
static std::optional<PluginMetaInformation> loadPlugin(const PluginData &pluginData);
|
||||
|
||||
static std::optional<PluginMetaInformation> loadPlugin(const std::string filePath);
|
||||
|
||||
static std::optional<PluginMetaInformation> loadPlugin(char *buffer, size_t size);
|
||||
|
||||
static std::optional<PluginMetaInformation> loadPlugin(elfio *reader);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user