mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2026-09-08 10:06:00 -05:00
Add new hooks to provide some WUT features like malloc wrapping, sd card access or using of std::threads
Updated the example plugins
This commit is contained in:
@@ -51,6 +51,8 @@ include $(WUPSDIR)/plugin_makefile.mk
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float
|
||||
|
||||
# -Os: optimise size
|
||||
# -Wall: generate lots of warnings
|
||||
# -D__wiiu__: define the symbol __wiiu__ (used in some headers)
|
||||
@@ -60,27 +62,24 @@ include $(WUPSDIR)/plugin_makefile.mk
|
||||
# -nostartfiles: Do not use the standard system startup files when linking
|
||||
# -ffunction-sections: split up functions so linker can garbage collect
|
||||
# -fdata-sections: split up data so linker can garbage collect
|
||||
COMMON_CFLAGS := -Os -Wall -mcpu=750 -meabi -mhard-float -D__WIIU__ -nostartfiles -ffunction-sections -fdata-sections -Wl,-q $(COMMON_CFLAGS)
|
||||
COMMON_CFLAGS := -O0 -Wall $(MACHDEP) -meabi -ffunction-sections -fdata-sections -Wl,-q $(COMMON_CFLAGS)
|
||||
|
||||
CFLAGS += -D__WIIU__ -D__WUT__
|
||||
|
||||
# -x c: compile as c code
|
||||
# -std=c11: use the c11 standard
|
||||
CFLAGS := $(COMMON_CFLAGS) -x c -std=gnu11 $(CFLAGS)
|
||||
|
||||
# -x c: compile as c++ code
|
||||
# -x c++: compile as c++ code
|
||||
# -std=gnu++11: use the c++11 standard
|
||||
CXXFLAGS := $(COMMON_CFLAGS) -x c++ -std=gnu++11 $(CXXFLAGS)
|
||||
|
||||
ifeq ($(DO_LOGGING), 1)
|
||||
CFLAGS += -D__LOGGING__
|
||||
CXXFLAGS += -D__LOGGING__
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra ld flags
|
||||
#--------------------------------------------------------------------------------
|
||||
# --gc-sections: remove unneeded symbols
|
||||
# -Map: generate a map file
|
||||
LDFLAGS += -Wl,-Map,$(notdir $@).map,--gc-sections
|
||||
LDFLAGS += $(ARCH) -Wl,-Map,$(notdir $@).map,--gc-sections,-wrap,__gxx_personality_v0
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@@ -97,33 +96,6 @@ LIBS +=
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS +=
|
||||
|
||||
NEEDS_WUT := 0
|
||||
|
||||
ifeq ($(WUT_ENABLE_CPP), 1)
|
||||
WUT_ENABLE_NEWLIB := 1
|
||||
|
||||
LDFLAGS += -Wl,-whole-archive,-lwutstdc++,-no-whole-archive
|
||||
NEEDS_WUT := 1
|
||||
endif
|
||||
|
||||
ifeq ($(WUT_ENABLE_NEWLIB), 1)
|
||||
LDFLAGS += -Wl,-whole-archive,-lwutnewlib,-no-whole-archive
|
||||
NEEDS_WUT := 1
|
||||
endif
|
||||
|
||||
ifeq ($(WUT_DEFAULT_MALLOC), 1)
|
||||
LDFLAGS += -Wl,-whole-archive,-lwutmalloc,-no-whole-archive
|
||||
NEEDS_WUT := 1
|
||||
endif
|
||||
|
||||
ifeq ($(NEEDS_WUT), 1)
|
||||
ifeq ($(strip $(WUT_ROOT)),)
|
||||
$(error "Please set WUT_ROOT in your environment. export WUT_ROOT=<path to>wut)
|
||||
endif
|
||||
CFLAGS += -D__WUT__
|
||||
CXXFLAGS += -D__WUT__
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
@@ -230,7 +202,7 @@ $(OUTPUT) : $(OFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.S
|
||||
@echo $(notdir $<)
|
||||
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER)
|
||||
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.png.o : %.png
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Compiling the projects with libutils logging code?
|
||||
DO_LOGGING := 1
|
||||
|
||||
# Links against the wut implementation of newlib, this is useful for using any function
|
||||
# from the C standard library
|
||||
WUT_ENABLE_NEWLIB := 0
|
||||
|
||||
# Links against the wut implementation of stdcpp, this is useful for using any function
|
||||
# from the C++ standard library. This will enable WUT_ENABLE_NEWLIB if you have not already done so.
|
||||
WUT_ENABLE_CPP := 0
|
||||
|
||||
# By default newlib will allocate 90% of the default heap for use with sbrk & malloc,
|
||||
# if this is unacceptable to you then you should use this as it replaces the newlib
|
||||
# malloc functions which ones which redirect to the CafeOS default heap functions
|
||||
# such as MEMAllocFromDefaultHeap.
|
||||
WUT_DEFAULT_MALLOC := 0
|
||||
|
||||
# Target filename
|
||||
TARGET := $(notdir $(CURDIR)).mod
|
||||
|
||||
@@ -43,12 +26,12 @@ LDFLAGS :=
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(WUPSDIR)
|
||||
LIBDIRS := $(WUPSDIR) $(WUT_ROOT) $(PORTLIBS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lwups
|
||||
LIBS := -lwups -lwut
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Will be added to the final lib paths
|
||||
|
||||
@@ -18,10 +18,18 @@ WUPS_PLUGIN_LICENSE("BSD");
|
||||
https://github.com/Maschell/WiiUPluginSystem/wiki/Using-hooks
|
||||
**/
|
||||
|
||||
// FS Access (replaces open/close/write/read etc. functions)
|
||||
WUPS_FS_ACCESS()
|
||||
// Overlay access
|
||||
//WUPS_ALLOW_OVERLAY()
|
||||
/**
|
||||
|
||||
WUPS_USE_WUT_MALLOC() // Use the wut malloc wrapper
|
||||
WUPS_USE_WUT_NEWLIB() // Use serveral function implementations
|
||||
WUPS_USE_WUT_DEVOPTAB() // Use wut devoptab for SD access
|
||||
WUPS_USE_WUT_STDCPP() // Use wut cpp wrappers
|
||||
|
||||
WUPS_USE_WUT_CRT() // Use all of them
|
||||
|
||||
**/
|
||||
|
||||
WUPS_USE_WUT_MALLOC() // Use the wut malloc wrapper
|
||||
|
||||
// Gets called once when the loader exits.
|
||||
INITIALIZE_PLUGIN(){
|
||||
@@ -38,13 +46,8 @@ ON_FUNCTIONS_PATCHED(){
|
||||
// Get called when ever GX2_VSYNC() was called (on each frame)
|
||||
ON_VYSNC(){
|
||||
}
|
||||
|
||||
// Gets called whenever the status of the running application changes.
|
||||
ON_APP_STATUS_CHANGED(status){
|
||||
}
|
||||
|
||||
// Called whenever an application is ending
|
||||
ON_APPLICATION_ENDING(){
|
||||
ON_APPLICATION_END(){
|
||||
}
|
||||
|
||||
// Gets called once when the loader is loaded again at the plugins will be unloaded
|
||||
@@ -62,4 +65,4 @@ DECL_FUNCTION(bool, OSIsHomeButtonMenuEnabled) {
|
||||
}
|
||||
|
||||
// Replace it.
|
||||
WUPS_MUST_REPLACE(OSIsHomeButtonMenuEnabled, WUPS_LOADER_LIBRARY_COREINIT, OSIsHomeButtonMenuEnabled);
|
||||
WUPS_MUST_REPLACE(OSIsHomeButtonMenuEnabled, WUPS_LOADER_LIBRARY_COREINIT, OSIsHomeButtonMenuEnabled);
|
||||
Reference in New Issue
Block a user