mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-08-24 03:44:07 -05:00
Use DEBUG_FUNCTION_LINE_ERR on error.
This commit is contained in:
@@ -15,7 +15,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
auto pluginName = plugin->getMetaInformation()->getName();
|
||||
|
||||
if (plugin_count >= MAXIMUM_PLUGINS - 1) {
|
||||
DEBUG_FUNCTION_LINE("Maximum of %d plugins reached. %s won't be loaded!", MAXIMUM_PLUGINS, pluginName.c_str());
|
||||
DEBUG_FUNCTION_LINE_ERR("Maximum of %d plugins reached. %s won't be loaded!", MAXIMUM_PLUGINS, pluginName.c_str());
|
||||
return false;
|
||||
}
|
||||
// Copy data to global struct.
|
||||
@@ -28,37 +28,37 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
auto plugin_meta_data = &plugin_data->meta;
|
||||
|
||||
if (pluginMetaInfo->getName().size() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: name will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: name will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->name, pluginMetaInfo->getName().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
if (pluginMetaInfo->getAuthor().size() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: author will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: author will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->author, pluginMetaInfo->getAuthor().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
|
||||
if (pluginMetaInfo->getVersion().size() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: version will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: version will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->version, pluginMetaInfo->getVersion().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
|
||||
if (pluginMetaInfo->getLicense().size() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: license will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: license will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->license, pluginMetaInfo->getLicense().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
|
||||
if (pluginMetaInfo->getBuildTimestamp().size() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: build timestamp will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: build timestamp will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->buildTimestamp, pluginMetaInfo->getBuildTimestamp().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
|
||||
if (pluginMetaInfo->getDescription().size() >= MAXIMUM_PLUGIN_DESCRIPTION_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: description will be truncated.");
|
||||
DEBUG_FUNCTION_LINE("%s", pluginMetaInfo->getDescription().c_str());
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: description will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("%s", pluginMetaInfo->getDescription().c_str());
|
||||
}
|
||||
strncpy(plugin_meta_data->descripion, pluginMetaInfo->getDescription().c_str(), MAXIMUM_PLUGIN_DESCRIPTION_LENGTH - 1);
|
||||
|
||||
if (pluginMetaInfo->getStorageId().length() >= MAXIMUM_PLUGIN_META_FIELD_LENGTH) {
|
||||
DEBUG_FUNCTION_LINE("Warning: plugin storage id will be truncated.");
|
||||
DEBUG_FUNCTION_LINE_ERR("Warning: plugin storage id will be truncated.");
|
||||
}
|
||||
strncpy(plugin_meta_data->storageId, pluginMetaInfo->getStorageId().c_str(), MAXIMUM_PLUGIN_META_FIELD_LENGTH - 1);
|
||||
|
||||
@@ -70,7 +70,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
auto relocationData = pluginInfo->getRelocationDataList();
|
||||
for (auto &reloc : relocationData) {
|
||||
if (!DynamicLinkingHelper::addReloationEntry(&(pluginInformation->linking_data), plugin_data->info.linking_entries, PLUGIN_DYN_LINK_RELOCATION_LIST_LENGTH, reloc)) {
|
||||
DEBUG_FUNCTION_LINE("Failed to add a relocation entry");
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to add a relocation entry");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -79,16 +79,16 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
auto hook_data_list = pluginInfo->getHookDataList();
|
||||
|
||||
if (function_data_list.size() > MAXIMUM_FUNCTION_PER_PLUGIN) {
|
||||
DEBUG_FUNCTION_LINE("Plugin %s would replace to many function (%d, maximum is %d). It won't be loaded.", pluginName.c_str(), function_data_list.size(), MAXIMUM_FUNCTION_PER_PLUGIN);
|
||||
DEBUG_FUNCTION_LINE_ERR("Plugin %s would replace to many function (%d, maximum is %d). It won't be loaded.", pluginName.c_str(), function_data_list.size(), MAXIMUM_FUNCTION_PER_PLUGIN);
|
||||
return false;
|
||||
}
|
||||
if (hook_data_list.size() > MAXIMUM_HOOKS_PER_PLUGIN) {
|
||||
DEBUG_FUNCTION_LINE("Plugin %s would set too many hooks (%d, maximum is %d). It won't be loaded.", pluginName.c_str(), hook_data_list.size(), MAXIMUM_HOOKS_PER_PLUGIN);
|
||||
DEBUG_FUNCTION_LINE_ERR("Plugin %s would set too many hooks (%d, maximum is %d). It won't be loaded.", pluginName.c_str(), hook_data_list.size(), MAXIMUM_HOOKS_PER_PLUGIN);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginName.length() > MAXIMUM_PLUGIN_NAME_LENGTH - 1) {
|
||||
DEBUG_FUNCTION_LINE("Name for plugin %s was too long to be stored.", pluginName.c_str());
|
||||
DEBUG_FUNCTION_LINE_ERR("Name for plugin %s was too long to be stored.", pluginName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
for (auto &curFunction : pluginInfo->getFunctionDataList()) {
|
||||
function_replacement_data_t *function_data = &plugin_data->info.functions[i];
|
||||
if (strlen(curFunction->getName().c_str()) > MAXIMUM_FUNCTION_NAME_LENGTH - 1) {
|
||||
DEBUG_FUNCTION_LINE("Could not add function \"%s\" for plugin \"%s\" function name is too long.", curFunction->getName().c_str(), pluginName.c_str());
|
||||
DEBUG_FUNCTION_LINE_ERR("Could not add function \"%s\" for plugin \"%s\" function name is too long.", curFunction->getName().c_str(), pluginName.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
if (foundFreeSlot) {
|
||||
auto *sectionInfo = &(plugin_data->info.sectionInfos[slot]);
|
||||
if (curSection.first.length() > MAXIMUM_PLUGIN_SECTION_NAME_LENGTH - 1) {
|
||||
DEBUG_FUNCTION_LINE("Could not add section info \"%s\" for plugin \"%s\" section name is too long.", curSection.first.c_str(), pluginName.c_str());
|
||||
DEBUG_FUNCTION_LINE_ERR("Could not add section info \"%s\" for plugin \"%s\" section name is too long.", curSection.first.c_str(), pluginName.c_str());
|
||||
break;
|
||||
}
|
||||
strncpy(sectionInfo->name, curSection.first.c_str(), MAXIMUM_PLUGIN_SECTION_NAME_LENGTH - 1);
|
||||
@@ -153,7 +153,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
sectionInfo->size = curSection.second->getSize();
|
||||
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("Failed to store SectionInfos");
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to store SectionInfos");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
|
||||
char *stringTable = (char *) MEMAllocFromExpHeapEx(heapHandle, funcSymStringLen, 0x4);
|
||||
if (stringTable == nullptr) {
|
||||
DEBUG_FUNCTION_LINE("Failed alloc memory to store string table for function symbol data");
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed alloc memory to store string table for function symbol data");
|
||||
return false;
|
||||
}
|
||||
memset(stringTable, 0, funcSymStringLen);
|
||||
@@ -180,7 +180,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
if (entryTable == nullptr) {
|
||||
MEMFreeToExpHeap((MEMHeapHandle) heapHandle, stringTable);
|
||||
free(stringTable);
|
||||
DEBUG_FUNCTION_LINE("Failed alloc memory to store function symbol data");
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed alloc memory to store function symbol data");
|
||||
return false;
|
||||
}
|
||||
DEBUG_FUNCTION_LINE("Allocated %d for the function symbol data", entryCount * sizeof(plugin_function_symbol_data_t));
|
||||
@@ -220,7 +220,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
|
||||
std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPlugins(plugin_information_t *pluginInformation) {
|
||||
std::vector<std::shared_ptr<PluginContainer>> result;
|
||||
if (pluginInformation == nullptr) {
|
||||
DEBUG_FUNCTION_LINE("pluginInformation == nullptr");
|
||||
DEBUG_FUNCTION_LINE_ERR("pluginInformation == nullptr");
|
||||
return result;
|
||||
}
|
||||
DCFlushRange((void *) pluginInformation, sizeof(plugin_information_t));
|
||||
@@ -228,7 +228,7 @@ std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPl
|
||||
|
||||
int32_t plugin_count = pluginInformation->number_used_plugins;
|
||||
if (plugin_count > MAXIMUM_PLUGINS) {
|
||||
DEBUG_FUNCTION_LINE("pluginInformation->plugin_count was bigger then allowed. %d > %d. Limiting to %d", plugin_count, MAXIMUM_PLUGINS, MAXIMUM_PLUGINS);
|
||||
DEBUG_FUNCTION_LINE_ERR("pluginInformation->plugin_count was bigger then allowed. %d > %d. Limiting to %d", plugin_count, MAXIMUM_PLUGINS, MAXIMUM_PLUGINS);
|
||||
plugin_count = MAXIMUM_PLUGINS;
|
||||
}
|
||||
for (int32_t i = 0; i < plugin_count; i++) {
|
||||
@@ -271,7 +271,7 @@ std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPl
|
||||
uint32_t hookCount = plugin_data->info.number_used_hooks;
|
||||
|
||||
if (hookCount > MAXIMUM_HOOKS_PER_PLUGIN) {
|
||||
DEBUG_FUNCTION_LINE("number_used_hooks was bigger then allowed. %d > %d. Limiting to %d", hookCount, MAXIMUM_HOOKS_PER_PLUGIN, MAXIMUM_HOOKS_PER_PLUGIN);
|
||||
DEBUG_FUNCTION_LINE_ERR("number_used_hooks was bigger then allowed. %d > %d. Limiting to %d", hookCount, MAXIMUM_HOOKS_PER_PLUGIN, MAXIMUM_HOOKS_PER_PLUGIN);
|
||||
hookCount = MAXIMUM_HOOKS_PER_PLUGIN;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPl
|
||||
}
|
||||
}
|
||||
if (!storageHasId) {
|
||||
DEBUG_FUNCTION_LINE("Plugin is using the storage API but has not set an ID");
|
||||
DEBUG_FUNCTION_LINE_ERR("Plugin is using the storage API but has not set an ID");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPl
|
||||
uint32_t functionReplaceCount = plugin_data->info.number_used_functions;
|
||||
|
||||
if (functionReplaceCount > MAXIMUM_FUNCTION_PER_PLUGIN) {
|
||||
DEBUG_FUNCTION_LINE("number_used_functions was bigger then allowed. %d > %d. Limiting to %d", functionReplaceCount, MAXIMUM_FUNCTION_PER_PLUGIN, MAXIMUM_FUNCTION_PER_PLUGIN);
|
||||
DEBUG_FUNCTION_LINE_ERR("number_used_functions was bigger then allowed. %d > %d. Limiting to %d", functionReplaceCount, MAXIMUM_FUNCTION_PER_PLUGIN, MAXIMUM_FUNCTION_PER_PLUGIN);
|
||||
functionReplaceCount = MAXIMUM_FUNCTION_PER_PLUGIN;
|
||||
}
|
||||
|
||||
@@ -315,13 +315,13 @@ std::vector<std::shared_ptr<PluginContainer>> PluginContainerPersistence::loadPl
|
||||
}
|
||||
dyn_linking_import_t *importEntry = linking_entry.importEntry;
|
||||
if (importEntry == nullptr) {
|
||||
DEBUG_FUNCTION_LINE("importEntry was nullptr, skipping relocation entry");
|
||||
DEBUG_FUNCTION_LINE_ERR("importEntry was nullptr, skipping relocation entry");
|
||||
continue;
|
||||
}
|
||||
dyn_linking_function_t *functionEntry = linking_entry.functionEntry;
|
||||
|
||||
if (functionEntry == nullptr) {
|
||||
DEBUG_FUNCTION_LINE("functionEntry was nullptr, skipping relocation entry");
|
||||
DEBUG_FUNCTION_LINE_ERR("functionEntry was nullptr, skipping relocation entry");
|
||||
continue;
|
||||
}
|
||||
auto rplInfo = std::make_shared<ImportRPLInformation>(importEntry->importName, importEntry->isData);
|
||||
|
||||
Reference in New Issue
Block a user