What's new

Rewriting N-Rage Rumble Pak support, add multibinds

rabiddeity

Plugin Hacker
I've been tinkering around with the source for N-Rage's 1.83 plugin to fix several issues I was having with it not detecting my joystick, and then rumble pak support not working, and I don't think it would be too difficult to add support for binding two DirectInput keys/buttons to one N64 button. (Many thanks to N-Rage for supplying the source in the first place!)

With 1.83 as it is, it seems like you can only bind buttons from one joystick to each controller. In other words, if I want to do something crazy like use two devices as one controller, it can't work. Not a problem for most people, but it is if you want to use separate steering wheel and pedals, for instance. No reason you shouldn't have the ability to do so.

Not to mention that the plugin as is will not even pick up a device that reports itself as a steering wheel, or a flightstick, as every acceptable device type is hardcoded. My original pad detection problem stemmed from the fact that when DirectInput queried what type of device I had, my gamepad reported itself as a flightstick. A weird driver bug? Either way, there's no reason you shouldn't be able to bind to whatever device(s) you want, as long as they're plugged in and DirectInput can recognize them. Easily fixed.

While I was poking around, I noticed that the DirectInput emulated rumble pak support seems reeeeeally sketchy. The way it works right now is like this: if we get any data directed toward a rumble pak, let's pulse the force feedback controller's motors for either 150ms or 300ms! It works, but it's not very accurate. According to a doc I googled, the way the REAL thing works is through a 32 byte control value sent directly to the pak, which switches the motor on the rumble pak on and off. I'm going to screw around with the debugger tonight and see if there are different signals sent for different levels of motor drive. DirectInput already has effects for turning a force feedback motor on indefinitely, and turning it off at will. If it works better, I'll post that change too.

I'd like to fix up some things in the code, improve on the force feedback support a bit, clean up the configuration dialogs, COMMENT THE FRIGGIN SOURCE, and add some documentation. Maybe I can clean up the way configs are stored in the registry too, get rid of that awful hex storage to make the whole thing human-editable and more portable between releases. Anyway, I'll post up an alpha release and source in a few days.
 

Doomulation

?????????????????????????
Did you check the already modified source of N-Rage of MadManMarkAu? Seemed to be re-writing the plugin to add some things, so...
I don't know for sure what's modified, but some things might be modified to help you.
 
OP
R

rabiddeity

Plugin Hacker
Hokay, I'm a bit of a tool. Looked over the source code again and it looks like the rumble pak stuff is emulated OK with starts and stops. I just had some old drivers that were causing some problems. And that source... REALLY needs to be cleaned up and commented. We could strip out some of the deprecated #ifdefs, not the debug ones but a particular set within PakIO.cpp comes to mind. Normally I'd just use a preprocessor to strip them out but I can't figure out how to get Visual Studio to output preprocessed files...?

Yep, I'm lookin at the 1.83 source, the latest release of the stickied post. If there's a latest build in progress, I can tell you what I changed to make my joystick (that DI thinks is a flightstick?) work. Simple addition to the HW detection cases, shouldn't break anything but feel free to test it out.

I've also figured out a way to get some buggier drivers working with rumble. Some drivers only play a rumble the first time. They SAY they've played the rumble OK even if they haven't. While there's no way to detect this, I've found that if you Unload and Download and then Start the effect again, it works. More code to execute every pass but it seems to fix some issues.

Also hacking around I've found out why PJ64's Jabo DirectInput slows down to a crawl in some places of Majora's Mask (like the starting cine, inventory menu) if you select Rumble support. It's because at these points the core is polling the HELL out of the Rumble Pak for some reason, like every single frame. Unfortunately in the 1.6 core this shows up as being 4300i instruction percentage so you can't tell that slowdown is coming from the input plugin! Not a problem with default N-Rage's though. Curious.
 
OP
R

rabiddeity

Plugin Hacker
More updates... ok, before I can add multiple binds to buttons, I need to understand N-Rage's BUTTON and CONTROLLER structs (so I can add to them), and these are of course uncommented in the code.

Also, in order to implement multiple gamepads per N64 controller, the button read code needs to be changed radically... right now the assumption is that a given keypress is coming from the keyboard, the mouse, or the configged gamepad.

Okay, first things first. Need to COMMENT the existing code, figure out all of the struct types and functions and variables, and label what they do in English.... Looks like I've got my work cut out for me.
 

Top