mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-16 17:59:17 +01:00
Add the PluginHeapHandle as an argument instead of using the global variable
This commit is contained in:
parent
037e1f2ce8
commit
ead8b14f98
@ -30,7 +30,7 @@ plugin_information_t *gPluginInformation __attribute__((section(".data"))) = NUL
|
|||||||
|
|
||||||
int test();
|
int test();
|
||||||
|
|
||||||
std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList);
|
std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList, MEMHeapHandle heapHandle);
|
||||||
|
|
||||||
#define gModuleData ((module_information_t *) (0x00880000))
|
#define gModuleData ((module_information_t *) (0x00880000))
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ int test() {
|
|||||||
std::vector<PluginData> pluginList = PluginDataFactory::loadDir("fs:/vol/external01/wiiu/plugins/", pluginDataHeap);
|
std::vector<PluginData> pluginList = PluginDataFactory::loadDir("fs:/vol/external01/wiiu/plugins/", pluginDataHeap);
|
||||||
DEBUG_FUNCTION_LINE("Loaded %d plugin data", pluginList.size());
|
DEBUG_FUNCTION_LINE("Loaded %d plugin data", pluginList.size());
|
||||||
|
|
||||||
std::vector<PluginContainer> plugins = loadPlugins(pluginList);
|
std::vector<PluginContainer> plugins = loadPlugins(pluginList, pluginDataHeap);
|
||||||
|
|
||||||
for (auto &pluginContainer : plugins) {
|
for (auto &pluginContainer : plugins) {
|
||||||
for (const auto &kv : pluginContainer.getPluginInformation().getSectionInfoList()) {
|
for (const auto &kv : pluginContainer.getPluginInformation().getSectionInfoList()) {
|
||||||
@ -110,7 +110,7 @@ int test() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList) {
|
std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList, MEMHeapHandle heapHandle) {
|
||||||
std::vector<PluginContainer> plugins;
|
std::vector<PluginContainer> plugins;
|
||||||
|
|
||||||
for (auto &pluginData : pluginList) {
|
for (auto &pluginData : pluginList) {
|
||||||
@ -127,7 +127,7 @@ std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginLi
|
|||||||
}
|
}
|
||||||
for (auto &pluginContainer : plugins) {
|
for (auto &pluginContainer : plugins) {
|
||||||
uint32_t trampolineId = pluginContainer.getPluginInformation().getTrampolinId();
|
uint32_t trampolineId = pluginContainer.getPluginInformation().getTrampolinId();
|
||||||
std::optional<PluginInformation> info = PluginInformationFactory::load(pluginContainer.getPluginData(), pluginDataHeap, gPluginInformation->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH, trampolineId);
|
std::optional<PluginInformation> info = PluginInformationFactory::load(pluginContainer.getPluginData(), heapHandle, gPluginInformation->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH, trampolineId);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to load Plugin %s", pluginContainer.getMetaInformation().getName().c_str());
|
DEBUG_FUNCTION_LINE("Failed to load Plugin %s", pluginContainer.getMetaInformation().getName().c_str());
|
||||||
|
@ -50,6 +50,7 @@ PluginData::PluginData(std::vector<uint8_t> input, MEMHeapHandle heapHandle, eMe
|
|||||||
default:
|
default:
|
||||||
case eMemTypeExpHeap:
|
case eMemTypeExpHeap:
|
||||||
data_copy = MEMAllocFromExpHeapEx(heapHandle, length, 4);
|
data_copy = MEMAllocFromExpHeapEx(heapHandle, length, 4);
|
||||||
|
DEBUG_FUNCTION_LINE("Allocated %d kb from ExpHeap", length / 1024);
|
||||||
if (data_copy == NULL) {
|
if (data_copy == NULL) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to allocate space on exp heap");
|
DEBUG_FUNCTION_LINE("Failed to allocate space on exp heap");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user