Go to file
Maschell 004f7f76e8 Make sure wut_get_thread_specific has been overriden properly 2023-07-19 16:14:05 +02:00
.github/workflows Change docker registry to ghcr.io 2023-04-01 08:48:36 +02:00
example/example_module Add information about the WUMS_DEPENDS_ON macro to the example module 2023-01-06 15:30:04 +01:00
include Make sure wut_get_thread_specific has been overriden properly 2023-07-19 16:14:05 +02:00
libraries/libwums Make sure wut_get_thread_specific has been overriden properly 2023-07-19 16:14:05 +02:00
share Add WUMS_DEPENDS_ON macro, bump version to 0.3.2 2023-01-06 15:30:04 +01:00
.clang-format Format the code via clang-format 2022-02-04 22:31:54 +01:00
.gitignore Formatting 2021-09-23 22:40:10 +02:00
Dockerfile Update Dockerfile 2023-06-22 16:27:17 +02:00
Dockerfile.buildexamples Update Dockerfile 2023-06-22 16:27:17 +02:00
Dockerfile.buildlocal Update Dockerfile 2023-06-22 16:27:17 +02:00
LICENSE Change LICENSE to LGPL 2022-09-04 17:34:37 +02:00
Makefile Fix reent usage for modules 2023-06-22 16:27:17 +02:00
README.MD Change docker registry to ghcr.io 2023-04-01 08:48:36 +02:00

README.MD

Publish Docker Image

Wii U Module System

This lib is designed to build modules to be loaded with the Wii U Module System Loader.

Usage

A module needs to implements at least the following macros.

#include <wums.h>

WUMS_MODULE_EXPORT_NAME("homebrew_modulename");

WUMS_INITIALIZE() {
    /** THIS CODE WILL BE RUN ONCE **/ 
}

The WUMS_MODULE_EXPORT_NAME needs to be a globally unique name across all loaded modules. WUMS_INITIALIZE defines the code that will be run after the module was loaded. The module will have full permission to the sd card via fs:/vol/external01.

Optional macros/hooks

Other optional macros/hooks are support, here some examples:

WUMS_APPLICATION_STARTS() {
    /** Is called when a new application was started. **/
}

WUMS_APPLICATION_REQUESTS_EXIT() {
    /** Is called when a new application is going to be closed. **/
}

This list is incomplete, see hooks.h for all hooks and meta.h for all macros.

Export functions

Modules can be used to export functions for other modules or "normal" applications.

#include <wums.h>

void MyCustomFunction() {
    /** Some special code that should be useable for everyone */
}

WUMS_EXPORT_FUNCTION(MyCustomFunction);

This function can then be used like they would be inside a .rpl, where the name of the "rpl" is the one defined in WUMS_MODULE_EXPORT_NAME.

Example using the Cafe OS OSDynLoad API:

if (OSDynLoad_Acquire("homebrew_modulename", &sModuleHandle) != OS_DYNLOAD_OK) {
    OSFatal("OSDynLoad_Acquire failed.");
}

void (*sMyCustomFunction)() = NULL;

if (OSDynLoad_FindExport(sModuleHandle, FALSE, "MyCustomFunction", (void**) &sMyCustomFunction) != OS_DYNLOAD_OK) {
    OSFatal("OSDynLoad_FindExport failed.");
}

Use this lib in Dockerfiles.

A prebuilt version of this lib can found on dockerhub. To use it for your projects, add this to your Dockerfile.

[...]
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:[tag] /artifacts $DEVKITPRO
[...]

Replace [tag] with a tag you want to use, a list of tags can be found here. It's highly recommended to pin the version to the latest date instead of using latest.

Format the code via docker

docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./include ./libraries ./example/example_module/source -i