Use latest WUMS version

This commit is contained in:
Maschell 2022-05-13 00:07:53 +02:00
parent 5a8c16b6d7
commit b847e92efc
2 changed files with 23 additions and 21 deletions

View File

@ -1,6 +1,6 @@
FROM wiiuenv/devkitppc:20211229
FROM wiiuenv/devkitppc:20220507
COPY --from=wiiuenv/libmappedmemory:20210924 /artifacts $DEVKITPRO
COPY --from=wiiuenv/wiiumodulesystem:20220127 /artifacts $DEVKITPRO
COPY --from=wiiuenv/libmappedmemory:20220211 /artifacts $DEVKITPRO
COPY --from=wiiuenv/wiiumodulesystem:20220512 /artifacts $DEVKITPRO
WORKDIR project

View File

@ -15,40 +15,42 @@ bool elfLinkOne(char type, size_t offset, int32_t addend, uint32_t destination,
RelocationType reloc_type);
WUMS_RELOCATIONS_DONE(args) {
module_information_t *gModuleData = args.module_information;
if (args.module_information == nullptr) {
auto *gModuleData = args.module_information;
if (gModuleData == nullptr) {
OSFatal("PatchMemoryRelocations: Failed to get gModuleData pointer.");
}
if (args.module_information->version != MODULE_INFORMATION_VERSION) {
if (gModuleData->version != MODULE_INFORMATION_VERSION) {
OSFatal("PatchMemoryRelocations: The module information struct version does not match.");
}
initLogging();
for (uint32_t i = 0; i < gModuleData->number_modules; i++) {
auto *curModule = &gModuleData->modules[i];
for (int32_t i = 0; i < gModuleData->number_used_modules; i++) {
if (strcmp("homebrew_memorymapping", gModuleData->module_data[i].module_export_name) == 0 ||
strcmp("homebrew_patchmemoryrelocations", gModuleData->module_data[i].module_export_name) == 0) {
DEBUG_FUNCTION_LINE_VERBOSE("Skip %s", gModuleData->module_data[i].module_export_name);
continue;
}
DEBUG_FUNCTION_LINE_VERBOSE("Patch relocations of %s", gModuleData->module_data[i].module_export_name);
for (auto &curEntry : gModuleData->module_data[i].linking_entries) {
if (curEntry.functionEntry == nullptr) {
if (strcmp("homebrew_memorymapping", curModule->module_export_name) == 0 ||
strcmp("homebrew_patchmemoryrelocations", curModule->module_export_name) == 0 ||
strcmp("homebrew_functionpatcher", curModule->module_export_name) == 0) {
DEBUG_FUNCTION_LINE_VERBOSE("Skip %s", curModule->module_export_name);
continue;
}
DEBUG_FUNCTION_LINE_VERBOSE("Patch relocations of %s", curModule->module_export_name);
for (uint32_t j = 0; j < curModule->number_linking_entries; j++) {
auto linkingEntry = &curModule->linking_entries[j];
uint32_t functionAddress = 0;
if (strncmp("coreinit", curEntry.importEntry->importName, DYN_LINK_IMPORT_NAME_LENGTH) == 0) {
if (strncmp("MEMAllocFromDefaultHeap", curEntry.functionEntry->functionName, DYN_LINK_FUNCTION_NAME_LENGTH) == 0) {
// Skip the ".fimport_" part of the importName when comparing
if (strcmp("coreinit", &linkingEntry->importEntry->importName[9]) == 0) {
if (strcmp("MEMAllocFromDefaultHeap", linkingEntry->functionName) == 0) {
functionAddress = (uint32_t) &MEMAllocFromMappedMemory;
} else if (strncmp("MEMAllocFromDefaultHeapEx", curEntry.functionEntry->functionName, DYN_LINK_FUNCTION_NAME_LENGTH) == 0) {
} else if (strcmp("MEMAllocFromDefaultHeapEx", linkingEntry->functionName) == 0) {
functionAddress = (uint32_t) &MEMAllocFromMappedMemoryEx;
} else if (strncmp("MEMFreeToDefaultHeap", curEntry.functionEntry->functionName, DYN_LINK_FUNCTION_NAME_LENGTH) == 0) {
} else if (strcmp("MEMFreeToDefaultHeap", linkingEntry->functionName) == 0) {
functionAddress = (uint32_t) &MEMFreeToMappedMemory;
}
if (functionAddress != 0) {
if (!elfLinkOne(curEntry.type, curEntry.offset, curEntry.addend, (uint32_t) curEntry.destination, functionAddress, nullptr, 0, RELOC_TYPE_IMPORT)) {
if (!elfLinkOne(linkingEntry->type, linkingEntry->offset, linkingEntry->addend, (uint32_t) linkingEntry->destination, functionAddress, nullptr, 0, RELOC_TYPE_IMPORT)) {
OSFatal("homebrew_patchmemoryrelocations: Relocation failed\n");
}
}