Giter Club home page Giter Club logo

wiiumodulesystem's Introduction

Publish Docker Image

Wii U Module System

This lib is required 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=wiiuenv/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 wiiuenv/clang-format:13.0.0-2 -r ./include ./libraries ./example/example_module/source -i

wiiumodulesystem's People

Contributors

maschell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.