Patch loader.elf to spit out less warnings when loading .rpx built with wut

This commit is contained in:
Maschell 2024-04-25 21:50:59 +02:00
parent ed4edfc2db
commit 4ee72d785b
3 changed files with 13 additions and 2 deletions

View File

@ -2,5 +2,6 @@ FROM ghcr.io/wiiu-env/devkitppc:20240423
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libkernel:20230621 /artifacts $DEVKITPRO
WORKDIR project

View File

@ -41,7 +41,7 @@ CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS) -std=c++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Tfunctionpatcher.ld $(WUMSSPECS)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Tfunctionpatcher.ld -T$(WUMS_ROOT)/share/libkernel.ld $(WUMSSPECS)
ifeq ($(DEBUG),1)
CXXFLAGS += -DDEBUG -g
@ -53,7 +53,7 @@ CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
endif
LIBS := -lwums -lwut -lfunctionpatcher
LIBS := -lwums -lwut -lfunctionpatcher -lkernel
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level

View File

@ -1,7 +1,9 @@
#include "globals.h"
#include "logger.h"
#include "patches_replacements.h"
#include <coreinit/cache.h>
#include <cstdlib>
#include <kernel/kernel.h>
// init is not called for this module. We need to make sure to init these values in initCommonPatches()
uint32_t gHeapMask;
@ -27,6 +29,14 @@ void initCommonPatches() {
}
}
DEBUG_FUNCTION_LINE("Common patches finished");
// Patch loader.elf to spit out less warnings when loading .rpx built with wut
KernelNOPAtPhysicalAddress(0x0100b770 - 0x01000000 + 0x32000000);
KernelNOPAtPhysicalAddress(0x0100b800 - 0x01000000 + 0x32000000);
KernelNOPAtPhysicalAddress(0x0100b7b8 - 0x01000000 + 0x32000000);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b770), 0x04);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b800), 0x04);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b7b8), 0x04);
}
void commonPatchesStart() {