Showing posts with label mod_joy. Show all posts
Showing posts with label mod_joy. Show all posts

Wednesday, August 11, 2010

Comments on Beta 2 and a refresh to the second beta.

As a first note, I'd like to comment that I've uploaded a beta 2 refresh. This is to solve a very small yet annoying bug I had missed: OS_WII was not being defined (ups!). It also includes small updates to libjoy and mod_joy coming from upstream.

As for the changes included in beta 2 with regard to beta 1, I'll highlight a few:

  • Exported mod_wm symbols. These where being compiled, but I forgot to export them, so they were unusable.
  • I also touched get_desktop_size() to return the size of the mode SDL has set. I wanted to have this return the Wii's native resolution for you, but this seems to not be easy as of now, so at least you've got a mode you can set_mode() to.
  • I also changed the dependency map so mod_mouse and mod_wpad both now depend on libjoy. This is to ensure correct hardware initialization and to improve compatibility with newer versions of the Homebrew Channel.
  • Speaking of mod_wpad, I improved it a bit. Now you can check if a particular controller has a Guitar Hero 3 guitar or a Classic Controller attached to it with:
    • WPAD_INFO(int channel, WPAD_HAS_GUITAR);
    • WPAD_INFO(int channel, WPAD_HAS_CLASSIC);
  • A few corresponding functions has been added to query those devices:
    • WPAD_INFO_CLASSIC(int channel, int info);
    • WPAD_INFO_GUITAR(int channel, int info);
  • info can (as of now) only retrieve the battery level from those, with the value:
    • WPAD_BATT
  • mod_wpad can now also report the acceleration, as read from the Nunchuk. Please remind that the Nunchuk can only read acceleration in one axis, the rest will be 0. To get those readings, use:
    • WPAD_INFO_NUNCHUK(int channel, int ACCELX);
    • WPAD_INFO_NUNCHUK(int channel, int ACCELY); and
    • WPAD_INFO_NUNCHUK(int channel, int ACCELZ);
  • We can now also read the orientation of the Wiimote (in thousandths of a degree, I must double check this is coherent with Bennu's way of doing things). This works with WPAD_INFO_NUNCHUK() too but again, the results will only be valid on certain axes. Here are the new functions:
    • WPAD_INFO(int channel, int WPAD_GX);
    • WPAD_INFO(int channel, int WPAD_GY); and
    • WPAD_INFO(int channel, int WPAD_GZ);
I believe that's pretty much it for the changes. Bugs have been solved, and some initial work has been done on integrating more unofficial modules, namely mod_image, mod_iconv and mod_sqlite3. But that's incomplete and has not been compiled into this release.

For a real example on how to use the new mod_wpad functionality, check this examples code.

Also, mod_debug has been left out in this release just because it makes the binaries bigger and I believe it'd be a pain to try to use it in a real Wii. If you need those, please let me know and I'll send you a copy of the binaries with mod_debug integrated.

I believe that's pretty much it, as always, you can get the binaries for the beta from the google code page.

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.