Skip to content
Tom Sherman edited this page Mar 7, 2017 · 16 revisions

Why use _main instead of main?

main is a special function name to the compiler and we want our _main to be treated like any other function. If you try to use main you will end up with a linker error. The only reason _main is even used in the tutorials is for readability - you can choose any name for this function.

Is the PAL version of the game supported?

Not yet, but this is a high priority.

How does the version system work?

The version is of the form x.y.z

z changes every time a bug is fixed or the code is updated
y changes every time a new feature is added (resets z to 0)
x changes whenever backwards compatibility is broken (reset y, z to 0)

This means that code written for 1.x.* will work when linked against 1.y.* for any y >= x, but 1.*.* is not compatible with 2.*.*

In order to check the version of the library, include version.h and use the macros MML_VERSION_MAJOR, MML_VERSION_MINOR, and MML_VERSION_REVISION to get the full version (i.e. MAJOR.MINOR.REVISION).

You can also use MML_VERSION_CHECK(major, minor) to get a true/false of whether or not the version of the library linked is up to date. Note this is evaluated at runtime, not compile time.

How do I report bugs in the library?

If you are familiar with GitHub Issues please use this for reporting errors in the library. Any bugs in the tutorial can be addressed in the tutorial_help channel on the Discord and there is a bugs channel if you don't want to use the issue system.

Why not use the libraries that come with devkitPPC?

It is possible to use these libraries in theory, but in practice this may result in unnecessarily large code - making it difficult to inject in the small amount of space available. The most important thing about writing mods for SSBM is code size, not accuracy or speed. libmml was written with this in mind. The speed and accuracy of the code in libmml is acceptable, and the code size is optimized as much as it can be (at least that is the primary goal).

First example: calling the sin function in libmml (MeleeModdlingLibrary) adds 48 lines of assembly code (192 bytes). Calling the equivalent sinf function in libm (default library in devkitPPC) adds 541 lines of assembly code (2164 bytes). The sin function in libmml is so much smaller because it can take advantage of the sin function which already exists in the code for melee.

Second example: calling the asin function in libmml adds 105 lines of assembly code (420 bytes). Calling the equivalent asinf function in libm adds 765 lines of assembly code (3060 bytes). In this case, there is no native asin function, libmml has its own implementation. The reason its so much smaller is libmml sacrifices some accuracy and speed in order to reduce the lines of code. Even with such a dramatic reduction, the error is small: Absolute error <= 6.7e-5 (according to http://http.developer.nvidia.com/Cg/acos.html).