-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example: Update the existing example_plugin and add C++ example plugin
- Loading branch information
Showing
11 changed files
with
700 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Generated from CLion C/C++ Code Style settings | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: Consecutive | ||
AlignConsecutiveMacros: AcrossEmptyLinesAndComments | ||
AlignOperands: Align | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllConstructorInitializersOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Always | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: Always | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
ColumnLimit: 0 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 8 | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MaxEmptyLinesToKeep: 2 | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
TabWidth: 4 | ||
UseTab: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM ghcr.io/wiiu-env/devkitppc:20230218 | ||
|
||
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230215 /artifacts $DEVKITPRO | ||
|
||
WORKDIR project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#------------------------------------------------------------------------------- | ||
.SUFFIXES: | ||
#------------------------------------------------------------------------------- | ||
|
||
ifeq ($(strip $(DEVKITPRO)),) | ||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro") | ||
endif | ||
|
||
TOPDIR ?= $(CURDIR) | ||
|
||
include $(DEVKITPRO)/wups/share/wups_rules | ||
|
||
WUT_ROOT := $(DEVKITPRO)/wut | ||
#------------------------------------------------------------------------------- | ||
# TARGET is the name of the output | ||
# BUILD is the directory where object files & intermediate files will be placed | ||
# SOURCES is a list of directories containing source code | ||
# DATA is a list of directories containing data files | ||
# INCLUDES is a list of directories containing header files | ||
#------------------------------------------------------------------------------- | ||
TARGET := ExamplePluginCPP | ||
BUILD := build | ||
SOURCES := src src/utils | ||
DATA := data | ||
INCLUDES := src | ||
|
||
#------------------------------------------------------------------------------- | ||
# options for code generation | ||
#------------------------------------------------------------------------------- | ||
CFLAGS := -g -Wall -O2 -ffunction-sections \ | ||
$(MACHDEP) | ||
|
||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -D__WUPS__ | ||
|
||
CXXFLAGS := $(CFLAGS) -std=c++20 | ||
|
||
ASFLAGS := -g $(ARCH) | ||
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) $(WUPSSPECS) | ||
|
||
LIBS := -lwups -lwut | ||
|
||
#------------------------------------------------------------------------------- | ||
# list of directories containing libraries, this must be the top level | ||
# containing include and lib | ||
#------------------------------------------------------------------------------- | ||
LIBDIRS := $(PORTLIBS) $(WUPS_ROOT) $(WUT_ROOT) | ||
|
||
#------------------------------------------------------------------------------- | ||
# no real need to edit anything past this point unless you need to add additional | ||
# rules for different file extensions | ||
#------------------------------------------------------------------------------- | ||
ifneq ($(BUILD),$(notdir $(CURDIR))) | ||
#------------------------------------------------------------------------------- | ||
|
||
export OUTPUT := $(CURDIR)/$(TARGET) | ||
export TOPDIR := $(CURDIR) | ||
|
||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ | ||
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) | ||
|
||
export DEPSDIR := $(CURDIR)/$(BUILD) | ||
|
||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) | ||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) | ||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) | ||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) | ||
|
||
#------------------------------------------------------------------------------- | ||
# use CXX for linking C++ projects, CC for standard C | ||
#------------------------------------------------------------------------------- | ||
ifeq ($(strip $(CPPFILES)),) | ||
#------------------------------------------------------------------------------- | ||
export LD := $(CC) | ||
#------------------------------------------------------------------------------- | ||
else | ||
#------------------------------------------------------------------------------- | ||
export LD := $(CXX) | ||
#------------------------------------------------------------------------------- | ||
endif | ||
#------------------------------------------------------------------------------- | ||
|
||
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) | ||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | ||
export OFILES := $(OFILES_BIN) $(OFILES_SRC) | ||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) | ||
|
||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ | ||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ | ||
-I$(CURDIR)/$(BUILD) | ||
|
||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) | ||
|
||
.PHONY: $(BUILD) clean all | ||
|
||
#------------------------------------------------------------------------------- | ||
all: $(BUILD) | ||
|
||
$(BUILD): | ||
@$(shell [ ! -d $(BUILD) ] && mkdir -p $(BUILD)) | ||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile | ||
|
||
#------------------------------------------------------------------------------- | ||
clean: | ||
@echo clean ... | ||
@rm -fr $(BUILD) $(TARGET).wps $(TARGET).elf | ||
|
||
#------------------------------------------------------------------------------- | ||
else | ||
.PHONY: all | ||
|
||
DEPENDS := $(OFILES:.o=.d) | ||
|
||
#------------------------------------------------------------------------------- | ||
# main targets | ||
#------------------------------------------------------------------------------- | ||
all : $(OUTPUT).wps | ||
|
||
$(OUTPUT).wps : $(OUTPUT).elf | ||
$(OUTPUT).elf : $(OFILES) | ||
|
||
$(OFILES_SRC) : $(HFILES_BIN) | ||
|
||
#------------------------------------------------------------------------------- | ||
# you need a rule like this for each extension you use as binary data | ||
#------------------------------------------------------------------------------- | ||
%.bin.o %_bin.h : %.bin | ||
#------------------------------------------------------------------------------- | ||
@echo $(notdir $<) | ||
@$(bin2o) | ||
|
||
-include $(DEPENDS) | ||
|
||
#------------------------------------------------------------------------------- | ||
endif | ||
#------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Example plugin | ||
|
||
This is just a simple example plugin which can be used as a template. | ||
The plugin logs the FSOpenFile calls via UDP (**Only when build via `make DEBUG=1`**). | ||
|
||
The logging can be enabled/disabled via the WUPS Config menu (press L, DPAD Down and Minus on the GamePad, Pro Controller or Classic Controller). | ||
|
||
## Installation | ||
|
||
(`[ENVIRONMENT]` is a placeholder for the actual environment name.) | ||
|
||
1. Copy the file `ExamplePlugin.wps` into `sd:/wiiu/environments/[ENVIRONMENT]/plugins`. | ||
2. Requires the [WiiUPluginLoaderBackend](https://github.com/wiiu-env/WiiUPluginLoaderBackend) in `sd:/wiiu/environments/[ENVIRONMENT]/modules`. | ||
|
||
Start the environment (e.g Aroma) and the backend should load the plugin. | ||
|
||
## Building | ||
|
||
For building you need: | ||
|
||
- [wups](https://github.com/Maschell/WiiUPluginSystem) | ||
- [wut](https://github.com/devkitpro/wut) | ||
|
||
Install them (in this order) according to their README's. Don't forget the dependencies of the libs itself. | ||
|
||
Then you should be able to compile via `make` (with no logging) or `make DEBUG=1` (with logging). | ||
|
||
## Buildflags | ||
|
||
### Logging | ||
|
||
Building via `make` only logs errors (via OSReport). To enable logging via the [LoggingModule](https://github.com/wiiu-env/LoggingModule) set `DEBUG` to `1` or `VERBOSE`. | ||
|
||
`make` Logs errors only (via OSReport). | ||
`make DEBUG=1` Enables information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). | ||
`make DEBUG=VERBOSE` Enables verbose information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). | ||
|
||
If the [LoggingModule](https://github.com/wiiu-env/LoggingModule) is not present, it'll fallback to UDP (Port 4405) and [CafeOS](https://github.com/wiiu-env/USBSerialLoggingModule) logging. | ||
|
||
## Building using the Dockerfile | ||
|
||
It's possible to use a docker image for building. This way you don't need anything installed on your host system. | ||
|
||
``` | ||
# Build docker image (only needed once) | ||
docker build . -t example-plugin-builder | ||
# make | ||
docker run -it --rm -v ${PWD}:/project example-plugin-builder make DEBUG=1 | ||
# make clean | ||
docker run -it --rm -v ${PWD}:/project example-plugin-builder make clean | ||
``` | ||
|
||
## Format the code via docker | ||
|
||
`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src -i` |
Oops, something went wrong.