mirror of
https://github.com/wiiu-env/MemoryMappingModule.git
synced 2024-11-21 17:29:21 +01:00
Use latest version of libfunctionpatcher
This commit is contained in:
parent
77360e935d
commit
d3f874ed2e
@ -1,7 +1,7 @@
|
|||||||
FROM wiiuenv/devkitppc:20220806
|
FROM wiiuenv/devkitppc:20221228
|
||||||
|
|
||||||
COPY --from=wiiuenv/libkernel:20220904 /artifacts $DEVKITPRO
|
COPY --from=wiiuenv/libkernel:20220904 /artifacts $DEVKITPRO
|
||||||
COPY --from=wiiuenv/libfunctionpatcher:20220904 /artifacts $DEVKITPRO
|
COPY --from=wiiuenv/libfunctionpatcher:20230106 /artifacts $DEVKITPRO
|
||||||
COPY --from=wiiuenv/wiiumodulesystem:20220904 /artifacts $DEVKITPRO
|
COPY --from=wiiuenv/wiiumodulesystem:20221005 /artifacts $DEVKITPRO
|
||||||
|
|
||||||
WORKDIR project
|
WORKDIR project
|
||||||
|
11
Makefile
11
Makefile
@ -36,7 +36,7 @@ CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
|||||||
CXXFLAGS := $(CFLAGS) -std=c++17 -fno-exceptions -fno-rtti
|
CXXFLAGS := $(CFLAGS) -std=c++17 -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -T$(WUMS_ROOT)/share/libkernel.ld -T$(WUMS_ROOT)/share/libfunctionpatcher.ld $(WUMSSPECS)
|
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -T$(WUMS_ROOT)/share/libkernel.ld -Tfunctionpatcher.ld $(WUMSSPECS)
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
CXXFLAGS += -DDEBUG -g
|
CXXFLAGS += -DDEBUG -g
|
||||||
@ -74,6 +74,7 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
|
|||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
|
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
|
||||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@ -91,7 +92,7 @@ endif
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
export OFILES_SRC := $(DEFFILES:.def=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||||
|
|
||||||
@ -138,7 +139,11 @@ $(OFILES_SRC) : $(HFILES_BIN)
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.def
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)rplimportgen $< $*.s $*.ld $(ERROR_FILTER)
|
||||||
|
$(SILENTCMD)$(CC) -x assembler-with-cpp $(ASFLAGS) -c $*.s -o $@ $(ERROR_FILTER)
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o: %.s
|
%.o: %.s
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
|
4
source/functionpatcher.def
Normal file
4
source/functionpatcher.def
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
:NAME homebrew_functionpatcher
|
||||||
|
|
||||||
|
:TEXT
|
||||||
|
FPAddFunctionPatch
|
@ -14,6 +14,9 @@ WUMS_MODULE_EXPORT_NAME("homebrew_memorymapping");
|
|||||||
WUMS_MODULE_SKIP_INIT_FINI();
|
WUMS_MODULE_SKIP_INIT_FINI();
|
||||||
WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK();
|
WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK();
|
||||||
|
|
||||||
|
// We can't use the functions from libfunctionpatcher. Defined in functionpatcher.def
|
||||||
|
extern "C" FunctionPatcherStatus FPAddFunctionPatch(function_replacement_data_t *function_data, PatchedFunctionHandle *outHandle, bool *outHasBeenPatched);
|
||||||
|
|
||||||
WUMS_INITIALIZE(args) {
|
WUMS_INITIALIZE(args) {
|
||||||
static uint8_t ucSetupRequired = 1;
|
static uint8_t ucSetupRequired = 1;
|
||||||
if (!ucSetupRequired) {
|
if (!ucSetupRequired) {
|
||||||
@ -24,14 +27,20 @@ WUMS_INITIALIZE(args) {
|
|||||||
MemoryMapping_setupMemoryMapping();
|
MemoryMapping_setupMemoryMapping();
|
||||||
MemoryMapping_CreateHeaps();
|
MemoryMapping_CreateHeaps();
|
||||||
|
|
||||||
|
/* We can not use FunctionPatcher_InitLibrary here because OSDynLoadAcquire is not patched yet.
|
||||||
|
if (FunctionPatcher_InitLibrary() != FUNCTION_PATCHER_RESULT_SUCCESS) {
|
||||||
|
OSFatal("homebrew_memorymapping: FunctionPatcher_InitLibrary failed");
|
||||||
|
}*/
|
||||||
|
|
||||||
for (uint32_t i = 0; i < function_replacements_size; i++) {
|
for (uint32_t i = 0; i < function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
// We don't need to save the handles because we never restore them anyway.
|
||||||
|
if (FPAddFunctionPatch(&function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("homebrew_memorymapping: Failed to patch function");
|
OSFatal("homebrew_memorymapping: Failed to patch function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WUMS_APPLICATION_STARTS() {
|
WUMS_APPLICATION_STARTS() {
|
||||||
OSReport("Running MemoryMappingModule " VERSION VERSION_EXTRA "\n");
|
OSReport("Running MemoryMappingModule " VERSION VERSION_EXTRA "\n");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user