mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-22 04:39:17 +01:00
Check if a plugin has a meta section
This commit is contained in:
parent
28d77bd1ce
commit
2b29db165c
@ -56,6 +56,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st
|
|||||||
|
|
||||||
uint32_t sec_num = reader.sections.size();
|
uint32_t sec_num = reader.sections.size();
|
||||||
|
|
||||||
|
bool hasMetaSection = false;
|
||||||
for (uint32_t i = 0; i < sec_num; ++i) {
|
for (uint32_t i = 0; i < sec_num; ++i) {
|
||||||
ELFIO::section *psec = reader.sections[i];
|
ELFIO::section *psec = reader.sections[i];
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st
|
|||||||
|
|
||||||
// Get meta information and check WUPS version:
|
// Get meta information and check WUPS version:
|
||||||
if (psec->get_name() == ".wups.meta") {
|
if (psec->get_name() == ".wups.meta") {
|
||||||
|
hasMetaSection = true;
|
||||||
const void *sectionData = psec->get_data();
|
const void *sectionData = psec->get_data();
|
||||||
uint32_t sectionSize = psec->get_size();
|
uint32_t sectionSize = psec->get_size();
|
||||||
|
|
||||||
@ -118,6 +120,11 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hasMetaSection) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("File has no \".wups.meta\" section");
|
||||||
|
error = PLUGIN_PARSE_ERROR_NO_PLUGIN;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
pluginInfo.setSize(pluginSize);
|
pluginInfo.setSize(pluginSize);
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
enum PluginParseErrors {
|
enum PluginParseErrors {
|
||||||
PLUGIN_PARSE_ERROR_NONE,
|
PLUGIN_PARSE_ERROR_NONE,
|
||||||
PLUGIN_PARSE_ERROR_UNKNOWN,
|
PLUGIN_PARSE_ERROR_UNKNOWN,
|
||||||
|
PLUGIN_PARSE_ERROR_NO_PLUGIN,
|
||||||
PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION,
|
PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION,
|
||||||
PLUGIN_PARSE_ERROR_BUFFER_EMPTY,
|
PLUGIN_PARSE_ERROR_BUFFER_EMPTY,
|
||||||
PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED,
|
PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED,
|
||||||
|
@ -125,6 +125,7 @@ extern "C" PluginBackendApiErrorType WUPSGetPluginMetaInformationEx(WUPSBackendG
|
|||||||
case PLUGIN_PARSE_ERROR_BUFFER_EMPTY:
|
case PLUGIN_PARSE_ERROR_BUFFER_EMPTY:
|
||||||
case PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED:
|
case PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED:
|
||||||
case PLUGIN_PARSE_ERROR_IO_ERROR:
|
case PLUGIN_PARSE_ERROR_IO_ERROR:
|
||||||
|
case PLUGIN_PARSE_ERROR_NO_PLUGIN:
|
||||||
*errOut = PLUGIN_BACKEND_PLUGIN_PARSE_ERROR_UNKNOWN;
|
*errOut = PLUGIN_BACKEND_PLUGIN_PARSE_ERROR_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user