Sunday, November 1, 2009

Binary release for the Homebrew Channel with bundled happiness. mod_joy is in :)

Haven't fixed mod_sound yet, but I've included mod_joy and think it might be a good time to release a binary version of the package, as it starts to be usable.

I have provided, as with most modules, some test code for the functionality inside mod_joy.
This library has been a bit more difficult than previous ones to integrate, as I had to do a few new things:

  • mod_joy depends in libjoy, so I had to get libjoy working first.
  • libjoy depends in libsdlhandler, so I had to get libsdlhandler working first.
  • The initialization code for libjoy is a bit more complex than the one found in other libs, so I had to add some functions to the header for libjoy.c that declared the initialization and finalization functions.
  • That also made me think that the way I was initializating the module code was not correct (as I was doing it from within bgdi code, not bgdrtm code).
    So I moved all the initialization code into the correct place in core/bgdrtm/src/sysprocs.c.
  • Also, libsdlhandler gets in charge of updating the SDL event list (a "list" that keeps track of things that change and should be noted, like pressing a key in your keyboard, moving your mouse or using you joystick, to name a few). So it has a function that must be ran every FRAME.
    I had to find the way to tell bennugd-wii to do it.
    Basically, you just have to use hook_add() in the initialization code with the correct hook, but that hook was in modules/libsdlhandler/libsdlhandler.c, so I had to declare the HOOK in modules/libsdlhandler/libsdlhandler.h.
By the way, I must take the function declaration out of core/bgdrtm/src/sysprocs.c as the code is getting pretty nasty. I will probably create a header for every modules (that doesn't have it) to declare all those needed externs.

For the brave, I've released a package with a binary snapshot of today's SVN code and the test code.
You can directly use it in the Homebrew Channel provided you read the included README file.
You can get it from the project homepage here.
Hope you like it.

No comments: