[Release] m3diaLib - A C++ library for easier homebrew development for the Nintendo 3DS

Discussion in '3DS - Homebrew Development and Emulators' started by StuntHacks, Sep 13, 2018.

?
  1. Yes, definetly

    8 vote(s)
    61.5%
  2. No, definetly not

    1 vote(s)
    7.7%
  3. Maybe, in the future

    4 vote(s)
    30.8%
  1. StuntHacks
    OP

    StuntHacks Member

    Newcomer
    2
    Jan 19, 2017
    Austria
    Vienna
    Over the last year, or so, I've been working on a library for easier 3DS-homebrew development. It's fully written in C++11 and supports sound, graphics and more. Keep in mind, that this library is still in beta. So, if you find any bugs or have any issues, please report them via GitHub.

    Useful links:
    Features
    The m3diaLib (spelled media-lib) is split into multiple modules, which can then be split into smaller parts:

    Core
    The core module contains all functionality for interacting with the system. Its features range from running and handling the app itself to displaying errors and running system applets.

    Its main features are:
    • A class for running your homebrew app
    • Easy interaction with the system itself
    • Starting and running applets
    • Time measurement
    • Support for the RomFS
    • Multithreading and concurrency
    Input
    The input module does what its name says: It handles each and every input for interacting with the user.

    Its main features are:
    • Handling button input
    • Handling touch input
    Audio
    The audio module can be used for both music and sound effects.
    Its main features are:
    • Loading or streaming audio files directly from the file system
    • Support for .wav and .mp3 (more to come!)
    • Two different classes, sound and music, which have features that can be helpful specific in their use case
    Graphics
    The graphics module is by far the biggest module. It handles anything graphic-wise, from rendering simple shapes to rendering and animating high-quality textures.

    Its main features are:
    • Support for the top and bottom screen
    • Support for stereoscopic 3D
    • Easy-to-use interface for fast rendering on both screens
    • Support for transformation of textures and sprites
    • Pre-coded shapes as well as a shape class for easily rendering your own shapes
    • Easy-to-use color system
    • Collision detection
    Utils
    The utils module contains all kind of useful utilities. Currently, it has the following functionality:
    • Basic encryption


    All features are well documented here. Examples can be viewed here.

    How to use it
    The barebones of a homebrew app using the m3diaLib would look like this:
    Code:
    #include <m3dia.hpp>
    
    int main() {
        m3d::Applet app;
    
        while (app.isRunning()) {
            if (m3d::buttons::buttonPressed(m3d::buttons::Button::Start)) {
                app.exit(); // exit if start is pressed
            }
        }
    }
    
    Easy, isn't it?


    Planned features
    Audio:
    • Microphone support
    • More file formats
    Core:
    • Support for all availiable os and system functionality
    Graphics:
    • Animation
    • RenderTargets
    • More file formats for textures
    • 3D support
    Networking:
    This module isn't availiable at the moment. However, it's planned features are:
    • A simple HTTP and WebSocket client and server
    • Socket support
    • A 3DS-download-game alternative (more on that at a later point)
    Utils:
    • ZIP compression and decompression
    • JSON and XML parsing
    • Secure random numbers
    ...and anything that strikes my mind in the future.

    Installation
    To install the library, download the latest release-build and execute the command
    Code:
    make install
    .

    To build it from the source, download the latest release and then execute the following commands:
    Code:
    make
    make install
    
    Dependencies
    To compile a m3diaLib-app, you need the following dependencies installed (install via devkitPro-pacman):
    • libctru
    • citro3d
    • citro2d
    • 3ds-tinyxml2
    • 3ds-zlib
    • 3ds-mpg123
    • 3ds-libpng
    • 3ds-freetype
    • tex3ds (if you want to use spritesheets)
    Credits
     
    Last edited by StuntHacks, Sep 13, 2018
    KyoLikesTrees, ry755, Y0shII and 9 others like this.
  2. Ramzitv1

    Ramzitv1 Advanced Member

    Newcomer
    1
    Apr 17, 2017
    interesting
     
  3. zoogie

    zoogie playing around in the dsiware

    Member
    20
    Nov 30, 2014
    Micronesia, Federated States of
    Nice to see stuff like this late in the 3ds's life.
     
  4. THEGUY3ds

    THEGUY3ds Advanced Member

    Newcomer
    2
    Apr 13, 2018
    Australia
    In The galaxy
    Nice
     
  5. bennyman123abc

    bennyman123abc GBAtemp Advanced Fan

    Member
    6
    Mar 21, 2013
    United States
    Some City
    This may bring more developers to the 3DS scene. This looks a lot simpler than using libctru directly tbh. I'ma give it a go!
     
    StuntHacks likes this.
  6. StuntHacks
    OP

    StuntHacks Member

    Newcomer
    2
    Jan 19, 2017
    Austria
    Vienna
    That was indeed my intention. The latest release now added 3D support as well as a few other new features and I'm already working in the next release! I'd love to see what you create with it!
     
    bennyman123abc likes this.
  7. bennyman123abc

    bennyman123abc GBAtemp Advanced Fan

    Member
    6
    Mar 21, 2013
    United States
    Some City
    The issue I'm experiencing is that this lib doesn't work with 11.8. It crashes when loading any homebrew written with it; including all of the examples. I can provide a Luma3DS stack trace if you'd like.
     
  8. StuntHacks
    OP

    StuntHacks Member

    Newcomer
    2
    Jan 19, 2017
    Austria
    Vienna
    Please, report it via GitHub. Please also include your Luma version and any other information that could be relevant, such as whether you are using a N3DS or not.
     
    Last edited by StuntHacks, Sep 29, 2018
  9. StuntHacks
    OP

    StuntHacks Member

    Newcomer
    2
    Jan 19, 2017
    Austria
    Vienna
    Update: This issue was resolved. It was an outdated toolchain, no problem with the lib itself.
     
    bennyman123abc likes this.
  10. KyoLikesTrees

    KyoLikesTrees Member

    Newcomer
    2
    Jun 17, 2018
    Austria
    I can't get my app with m3diaLib to compile, it always says:
    Code:
    C:/devkitPro/portlibs/3ds/include/m3d/audio/music.hpp:10:10: fatal error: atomic: No such file or directory
     #include <atomic>
    even though that file (atomic) is in the IncludePath of Visual Studio Community 2017, which i'm using.

    I hope this is the right place to post about this but I can't find any errors on my side, so..
    Does anyone know what could be wrong?
    Thanks in advance.

    (edit because i wanted to add some things i forgot to say)
     
    Last edited by KyoLikesTrees, Nov 16, 2018
  11. StuntHacks
    OP

    StuntHacks Member

    Newcomer
    2
    Jan 19, 2017
    Austria
    Vienna
    Are you using the Makefile from the m3dctr-examples? If not, can you show me your current Makefile?

    Also, that error should only happen when you try to build the m3diaLib itself, not a project that uses it.
     
  12. KyoLikesTrees

    KyoLikesTrees Member

    Newcomer
    2
    Jun 17, 2018
    Austria
    I'm sorry that I didn't answer earlier, I used this one (yes i was playing around with the homebrew launcher):
    Warning: Spoilers inside!
    I could try using an example makefile but idk if it breaks anything else.

    Thanks.
     
Loading...