mirror of
https://github.com/wiiu-env/AromaBaseModule.git
synced 2024-12-18 07:51:49 +01:00
Use WUMS 0.3.2 and latest libfunctionpatcher
This commit is contained in:
parent
15c0971aae
commit
4803d90ddf
@ -1,6 +1,6 @@
|
|||||||
FROM wiiuenv/devkitppc:20220917
|
FROM wiiuenv/devkitppc:20221228
|
||||||
|
|
||||||
COPY --from=wiiuenv/libfunctionpatcher:20220904 /artifacts $DEVKITPRO
|
COPY --from=wiiuenv/libfunctionpatcher:20230106 /artifacts $DEVKITPRO
|
||||||
COPY --from=wiiuenv/wiiumodulesystem:20221005 /artifacts $DEVKITPRO
|
COPY --from=wiiuenv/wiiumodulesystem:20230106 /artifacts $DEVKITPRO
|
||||||
|
|
||||||
WORKDIR project
|
WORKDIR project
|
||||||
|
10
Makefile
10
Makefile
@ -41,7 +41,7 @@ CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
|||||||
CXXFLAGS := $(CFLAGS) -std=c++20
|
CXXFLAGS := $(CFLAGS) -std=c++20
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -T$(WUMS_ROOT)/share/libfunctionpatcher.ld $(WUMSSPECS)
|
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Tfunctionpatcher.ld $(WUMSSPECS)
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
CXXFLAGS += -DDEBUG -g
|
CXXFLAGS += -DDEBUG -g
|
||||||
@ -79,6 +79,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)/*.*)))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@ -96,7 +97,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)))
|
||||||
|
|
||||||
@ -145,6 +146,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)
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
void initApplicationEndsHook() {
|
void initApplicationEndsHook() {
|
||||||
DEBUG_FUNCTION_LINE("Patch ApplicationEndsHook functions");
|
DEBUG_FUNCTION_LINE("Patch ApplicationEndsHook functions");
|
||||||
for (uint32_t i = 0; i < applicationendshook_function_replacements_size; i++) {
|
for (uint32_t i = 0; i < applicationendshook_function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&applicationendshook_function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
if (FunctionPatcher_AddFunctionPatch(&applicationendshook_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("AromaBaseModule: Failed to patch ApplicationEndsHook function");
|
OSFatal("AromaBaseModule: Failed to patch ApplicationEndsHook function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
extern "C" FunctionPatcherStatus FPAddFunctionPatch(function_replacement_data_t *function_data, PatchedFunctionHandle *outHandle, bool *outHasBeenPatched);
|
||||||
|
|
||||||
void initDynload() {
|
void initDynload() {
|
||||||
gLoadedRPLData = (LOADED_RPL *) malloc(sizeof(LOADED_RPL) * gModuleData->number_modules);
|
gLoadedRPLData = (LOADED_RPL *) malloc(sizeof(LOADED_RPL) * gModuleData->number_modules);
|
||||||
if (!gLoadedRPLData) {
|
if (!gLoadedRPLData) {
|
||||||
@ -18,7 +20,9 @@ void initDynload() {
|
|||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Patch functions for dynload patches");
|
DEBUG_FUNCTION_LINE("Patch functions for dynload patches");
|
||||||
for (uint32_t i = 0; i < dynload_function_replacements_size; i++) {
|
for (uint32_t i = 0; i < dynload_function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&dynload_function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
// We need to use FPAddFunctionPatch because we can't use libfunctionpatcher yet. This patch enables it though.
|
||||||
|
if (FPAddFunctionPatch(&dynload_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("AromaBaseModule: Failed to patch function for dynload patches");
|
OSFatal("AromaBaseModule: Failed to patch function for dynload patches");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
source/functionpatcher.def
Normal file
4
source/functionpatcher.def
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
:NAME homebrew_functionpatcher
|
||||||
|
|
||||||
|
:TEXT
|
||||||
|
FPAddFunctionPatch
|
@ -1,4 +1,5 @@
|
|||||||
#include "dynload/loader_defines.h"
|
#include "dynload/loader_defines.h"
|
||||||
|
#include <function_patcher/fpatching_defines.h>
|
||||||
#include <wums.h>
|
#include <wums.h>
|
||||||
|
|
||||||
extern module_information_t *gModuleData;
|
extern module_information_t *gModuleData;
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
#include "sdrefcount/refcount.h"
|
#include "sdrefcount/refcount.h"
|
||||||
#include "symbolnamepatcher/symbolname.h"
|
#include "symbolnamepatcher/symbolname.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include <function_patcher/function_patching.h>
|
||||||
#include <wums.h>
|
#include <wums.h>
|
||||||
|
|
||||||
WUMS_MODULE_EXPORT_NAME("homebrew_basemodule");
|
WUMS_MODULE_EXPORT_NAME("homebrew_basemodule");
|
||||||
WUMS_MODULE_SKIP_INIT_FINI();
|
WUMS_MODULE_SKIP_INIT_FINI();
|
||||||
|
WUMS_DEPENDS_ON(homebrew_functionpatcher);
|
||||||
|
|
||||||
#define VERSION "v0.2.0"
|
#define VERSION "v0.2.0"
|
||||||
|
|
||||||
@ -23,10 +25,18 @@ WUMS_INITIALIZE(args) {
|
|||||||
OSFatal("AromaBaseModule: The module information struct version does not match.");
|
OSFatal("AromaBaseModule: The module information struct version does not match.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First init Dynload to have proper OSDynLoad support!
|
||||||
|
initDynload();
|
||||||
|
|
||||||
|
// Now init the library so we can use it for the other patches.
|
||||||
|
if (FunctionPatcher_InitLibrary() != FUNCTION_PATCHER_RESULT_SUCCESS) {
|
||||||
|
OSFatal("homebrew_basemodule: FunctionPatcher_InitLibrary failed");
|
||||||
|
}
|
||||||
|
|
||||||
initApplicationEndsHook();
|
initApplicationEndsHook();
|
||||||
initSDRefCount();
|
initSDRefCount();
|
||||||
initSymbolNamePatcher();
|
initSymbolNamePatcher();
|
||||||
initDynload();
|
|
||||||
initCommonPatches();
|
initCommonPatches();
|
||||||
|
|
||||||
deinitLogging();
|
deinitLogging();
|
||||||
|
@ -21,7 +21,8 @@ void initCommonPatches() {
|
|||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Do common patches");
|
DEBUG_FUNCTION_LINE("Do common patches");
|
||||||
for (uint32_t i = 0; i < patches_function_replacements_size; i++) {
|
for (uint32_t i = 0; i < patches_function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&patches_function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
if (FunctionPatcher_AddFunctionPatch(&patches_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("AromaBaseModule: Failed apply common patches");
|
OSFatal("AromaBaseModule: Failed apply common patches");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ void initSDRefCount() {
|
|||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Patch SDRefCount functions");
|
DEBUG_FUNCTION_LINE("Patch SDRefCount functions");
|
||||||
for (uint32_t i = 0; i < sdrefcount_function_replacements_size; i++) {
|
for (uint32_t i = 0; i < sdrefcount_function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&sdrefcount_function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
if (FunctionPatcher_AddFunctionPatch(&sdrefcount_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("AromaBaseModule: Failed to patch function for sd ref counting");
|
OSFatal("AromaBaseModule: Failed to patch function for sd ref counting");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
void initSymbolNamePatcher() {
|
void initSymbolNamePatcher() {
|
||||||
DEBUG_FUNCTION_LINE("Patch SymbolNamePatcher functions");
|
DEBUG_FUNCTION_LINE("Patch SymbolNamePatcher functions");
|
||||||
for (uint32_t i = 0; i < symbolname_function_replacements_size; i++) {
|
for (uint32_t i = 0; i < symbolname_function_replacements_size; i++) {
|
||||||
if (!FunctionPatcherPatchFunction(&symbolname_function_replacements[i], nullptr)) {
|
bool wasPatched = false;
|
||||||
|
if (FunctionPatcher_AddFunctionPatch(&symbolname_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||||
OSFatal("AromaBaseModule: Failed to patch SymbolNamePatcher function");
|
OSFatal("AromaBaseModule: Failed to patch SymbolNamePatcher function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user