What's new

Where to interface Rumble Pak? (custom input plug-in)

paulscode

New member
I am customizing the input plug-in (based on Input-SDL source), and trying to figure out where to interface the Rumble Pak. It looks like the correct function is in ControllerCommand, so that's where I'm starting. From there, it looks like I need to be under:

Code:
switch( Command[2] )
{
    ...

    case RD_WRITEPAK:

From there (starting to be less certain at this point) it looks like I then need to be under:

Code:
if (controller[Control].control->Plugin == PLUGIN_RAW)
{
    ...


I created two interface functions, for starting and stopping the rumble effect. Based on how the linux joystick rumble is hooked up, I came up with the following:

Code:
#ifdef ANDROID
                if( dwAddress == PAK_IO_RUMBLE )
                {
                    if( *Data )
                    {
                        DebugMessage( M64MSG_INFO, "Android, activating device vibrator" );
                        Android_JNI_Vibrate( 1 );
                    }
                    else
                    {
                        DebugMessage( M64MSG_INFO, "Android, deactivating device vibrator" );
                        Android_JNI_Vibrate( 0 );
                    }
                }
#endif

However, it doesn't look like this code is ever running. I'm thinking the problem is that the condition "->Plugin == PLUGIN_RAW" is the problem. Any thoughts on how to correct this? I could try removing the conditional statement (it's also used earlier in the code under "case RD_READPAK:"), but I'm not sure if this would create other problems. Thought I'd ask here to see what is the "proper" way to do this before I start screwing around with it.
 

Richard42

Emulator Developer
Hello paulscode,
The code that you posted looks correct. Some things that you should check are:
1. make sure the game that you are testing with supports rumble
2. make sure that you have the "virtual rumble pak" inserted in the controller. Just like the real N64, Mupen64Plus supports different types of packs which can be plugged in to the controller. Each controller can have a memory pack, a rumble pack, or no pack. You can set the pack type in the config file before starting or with specially mapped keys/buttons during play. If the emulator is not configured to use the rumble pack for your test controller, this code will never be called.
3. Make sure that you are still calling the DataCRC() function after your #ifdef ANDROID section. If the game does not see the correct CRC it will assume the rumble pack is broken or not present and it will stop talking to it.
 

Top