What's new

NRage Input Plugin V2.00 BETA (an overhaul)

rabiddeity

Plugin Hacker
NRage Input Plugin (an overhaul)

This is my overhaul of NRage's DirectInput8 Plugin.

2.3 RELEASE

I got sick of wrestling with a bug or two in NRage's DirectInput8 plugin, and decided to delve into the code and fix them myself. Well, one thing led to another, and I kinda wound up rewriting most of it. If you're going to fix one bug, you might as well fix them all, right?

THE MANUAL (please read this before asking questions):
CHM or Online Manual

RELEASE BINARY (most people want this):
Download version 2.3(from adf.ly)

SOURCE (for hackers and those who lurve the GPL):
download from Subversion server

LANGUAGE SDK (for people doing translations):
http://www.randomwisdom.com/files/NRage_DInput8_Lang_SDK.zip

Translations (unpack the dll file to your emulator's directory, NOT the plugin directory)
German by aTomIC
Simplified Chinese by Harlay
Spanish by NaSeR
French by Siskoo

Finally, here's a Keyboard/Mouse basic config file to give you some ideas for Goldeneye and Perfect Dark:
http://www.randomwisdom.com/files/NRage_Config_KeyMouse.zip

This version of the plugin will NOT overwrite settings from 1.83 and before, but neither will it read from older config files or saves (it stores config data differently). This means that you can run the plugin alongside older versions of the plugin, for comparison. But it also means you will have to bind your keys from defaults when you first run 2.x versions.

Current TODO list:

-running with a gamepad unplugged or unplugging during emulation must not cause crashes
-mouse locking: fix problems with mouse binding in control panel while running
-mouse locking: should unlock mouse when closing a ROM
-redo keyboard/mouse cpf on this post
+rewrite Adaptoid code to be asynchronous
+add reading gba ROMs from zip files

Fixed, added, or changed:

+ Switching between paks with shortcuts unplugs the current pak and waits before putting in the new one.
+ Shortcut "notifications" should work correctly now (Thanks Koolsmoky)
+ Better detection of devices; more joysticks should work now, as well as steering wheels and things that aren't strictly "gamepads"
+ N64 controllers can now get input from multiple gamepad type devices
+ Now able to assign a key, mouse, or gamepad control to as many N64 control surfaces as you like
/ device selection for keybinding no longer needed; devices list now shown as "Force-Feedback Devices" under ControllerPak selection (pick Rumble, and tick the "RawMode" box)
/ no longer possible to send FF events from multiple controllers to the same FF device (this shouldn't have worked anyway)
+ now captures mouseclicks properly in Controllers tab (disable button clicks while polling)
+ INTERNATIONAL SUPPORT (and internally switched to Unicode)
+ releases exclusive mouse while in config menu (fixed a mouse bind while locked issue)
+ add independent X/Y mouse sensitivity
+ changed absolute mouse support: now choose between Buffered (default from before), Absolute, and Deadpan (control only moves while you move the mouse)
+ various optimizations, bugfixes, and spelling fixes
+ LOTS of documentation added to the source; it should be more legible now
+ rewrote controller save and restore (underlying CONTROLLER and BUTTON structs changed...)
/ Button mappings and modifiers will need to be reset on first load
+ now rewrites mempak and transferpak RAM to disk immediately after writing to controller (1.83 and previous didn't save the mempak until RomClose)
+ now possible to map shortcuts to buttons and axes as well as keys (be careful)
+ tabbing within the config window actually works now
+ can save and load shortcuts
+ Transferpak MBC5 support fixed (Pokemon Yellow, Perfect Dark)
/ Win98/ME registry load finally fixed :)
+ lots of crash bugs fixed

2.1 is now in "release candidate" stage. Please test any bugs you find vs the latest DEBUG version, and if they still exist there please post.
--rabid
 
Last edited by a moderator:
OP
R

rabiddeity

Plugin Hacker
FAQ and dev notes

Some answers to questions I know will come up.

Q: Where did the Device selection screen go? How do I set up my joystick?
A: Joystick buttons will work as is. You no longer have to select a joystick device from a list.

Q: What about Force-Feedback support?
A: Select the Rumble-Pak from the Controller Pak menu. Make sure RawMode is selected. You can select a Force-Feedback device from the list.

Q: My joystick doesn't show up in the list!
A: Only devices that support DirectInput Force-Feedback will appear in the list. If you just want to assign buttons, you don't have to select your joystick from any lists; just click on the button you want to assign, and press the joystick button or axis. If a device doesn't show up and you know it supports Force Feedback, make sure it is not selected on a different controller. If it is, change that controller's FF device to "None" and it will show up in other lists again.

Q: What about that XInput fix that was released for X360 controllers awhile back?
A: Unfortunately, ward12e never released his source code, and the source code has changed too much from 1.83 to make a backport possible. However, it's not a major setback. You need to download 3rd party XBCD drivers. Follow the instructions on the following site. Download the configuration for "triggers as two buttons":
Xbcd 360 Download Page
You should be aware that I have no intention of adding XInput support now or in the forseeable future, as it does not and cannot replace DirectInput. In addition, adding support for it would bloat the existing code and add bugs. You should petition Microsoft to fix their broken X360 drivers to work properly with DirectInput, or help the XBCD team write a better driver.

Dev Notes

Work on the 2.1 line is well underway. Here are the features that are currently under development, in order of priority, and their progress.

* Switch from using the registry to using a single INI file with all the settings. (All registry funcs have been removed, and INI loading/saving funcs have been stubbed in. Writing INI format now.)

* Write utility to read in settings from old registry values and output new INI format. (Will start when INI loading/saving is finished. Idea: maybe I can get it to convert Jabo's input settings as well?)

* Add support for recognizing hot-plugged DInput devices without restart. (Not yet started.)

* Fix adaptoid support (Adaptoid, rumble pak, and transfer pak purchased; need to find an N64 controller because my old ones are back home on another continent.)

* Add support for Plugin Spec 1.1: main change is per-game controller settings (Not yet started, as I don't have a version of PJ64 1.7 to play with.)
 
Last edited:
OP
R

rabiddeity

Plugin Hacker
*File updated*

Fixed a last minute brain fart bug that made shortcuts not load properly from files or from defaults.
 

Harlay

New member
I'm use PS2 pad with ntpadxp 2.01.
and setting rumble pak with it.
loading any rumble game, the emulator is crash but the not rumble game.
it's all fine in NRage DInput8 V2 1.83 with same configure.
 
Last edited:
OP
R

rabiddeity

Plugin Hacker
What happens when you use the "Test Rumble" button in config? Does it rumble? Or does it crash?

edit: Also, which emulator are you using? If you try a different emulator, does it still crash? (Not that the emulator is at fault, but it will help me track down the problem.)
 
Last edited:

Harlay

New member
I'm useing PJ64 1.6.
when i click the "Test Rumble" button, it's no effects.
then i click the "save" button, and emulator crashed.
if i don't select the "rumble pak", when i click the "save" button, the emulator will not crash.
and i'm trying the 1964 0.9.9, it's not crash any more. but the pad is not rumble in game and the "Test Rumble" button.
 
OP
R

rabiddeity

Plugin Hacker
Crashing when starting a game and crashing when you hit "Save" are two different things. Which one is it?

Plus, if the "Test Rumble" button isn't working, then it's a good bet rumble won't work in the game...

Try this: in the RumblePak config, select "None" from the list of Force-Feedback devices. Click Save. Open the config again, and select your PS2 controller from the list. (This will force the plugin to reinitialize the rumble effect.) Press "Test Rumble" and see if anything happens.

I'm adding in extra checking to MAKE SURE the devices are getting initialized properly and display some useful information if they aren't. Check for an update within 24 hours.

Files updated. Hopefully this version shouldn't crash, even if it doesn't rumble.

edit: Sorry, couldn't test that b/c no access to a controller at work. Extra dialogs removed now; shouldn't get any if everything is working OK.
 
Last edited by a moderator:

Harlay

New member
rabiddeity said:
Crashing when starting a game and crashing when you hit "Save" are two different things. Which one is it?
both of them before.
I'm trying the new plugins.
the game is not crash now.
but no rumble yet.
when I click the "Test Rumble" button, a "NRage Plugin Error" dialog is appear. it show "DIEffect didn't start. Error description: function incorrect."
if I click it frequently, the PS2 pad will rumble.
 
OP
R

rabiddeity

Plugin Hacker
OK, so we know the test rumble is failing when it shouldn't be. I've made another change in the code to give a more descriptive directinput specific error message (default windows error messages are crap in this case). Download and run again, and tell me what the error message is.
 
OP
R

rabiddeity

Plugin Hacker
Undocumented means it was an error not listed in the DirectInput specifications... grr. Alright, I went and dug into the header files to try to find out what's going on. Unfortunately, "1" means any one of the following:

DI_NOTATTACHED (the device doesn't appear to be connected; can happen if you've got a bad wire or controller, or if the driver is bad)
DI_BUFFEROVERFLOW (too much data was sent to the device, shouldn't happen when we try to send one simple effect)
DI_NOEFFECT (from the header file: "the operation had no effect". Obviously it had no effect, otherwise I wouldn't be digging around in here. Doesn't help fix the problem.)

I've set it to try downloading the effect in advance, and to only play one effect at a time. That would fix the "buffer overflow" issue if there is one. I'm also tweaking the rumble init stuff to be a bit more informative if any of the init steps fail. Give this one a shot and see if it works.

To be honest I can't think of any reason the in-game rumble would work on 1.83 and not on 2.00; I haven't changed that much in the DirectInputEffect inits. In any case, I know it won't work if the test rumble doesn't work. Once that starts working I'll know what to fix on the main end.

Latest version up, please see if this is any better. (You may still get the error popup, but if it rumbles at all I'll consider that success.)
 

Harlay

New member
It's no rumble in game. and I click the "Test Rumble" button first, it's no error popup, but it will shows from the twice click. and i click it frequently, the PS2 pad will rumble.
 
OP
R

rabiddeity

Plugin Hacker
Clicking on test rumble like mad, right? Sounds like a few things:

1. the PS2 rumble motor takes a little while to spin up? maybe 150ms is too short to pick it up... try Ramp force and see if clicking once helps. Also, move the rumble strength slider all the way to 100%
2. ntpadxp can only play one effect at a time OR ntpadxp refuses to play the effect unless the NODOWNLOAD flag is selected... The former shouldn't cause any problems. The latter... it's a stupid bug in ntpadxp, but if that's the problem I can fix it.

One other thing to realize: the test rumble button does exactly ONE rumble pulse. I have two different force feedback controllers, one made by Elecom and one by Logitech. On both of them, the rumble pulse is there, but it's a bit hard to feel it. Normally clicking the button just once, you should feel it.

If you get it to work, let me know. I put up a fresh compile just now, so you can try that as well.
 

Harlay

New member
I'm trying the 1st way, but no helps.
and I changed my pad driver to PSXPAD 030220, no rumble either, but 1.83 did.

The different things of psxpad from ntpadxp:
1, the "save" button is not crash.
2, click "test rumble" frequently is not rumble.

The same things of psxpad from ntpadxp:
1, no rumble in game.
2, same error popup with same error message.
 
OP
R

rabiddeity

Plugin Hacker
I just found a really STUPID mistake on my part, that was throwing out these "Undocumented" errors. I fixed that, so now it should give you more useful error messages for the rumble. Sorry, Harlay, download the latest version and see if it tells us anything useful.

For anyone else who's watching, I also updated the source tree. Here are a couple other things I've fixed since the last release:

DexDrive save files and read-only files now WORK! (One or more permutations of those crashed 1.83 as well. Now it should work OK.)

However, I noticed along the way that .a64 ("note files") are not being created correctly in 2.00. I'm stepping through the original 1.83 code with a debugger and I think the original code magically glitched through to a solution. It certainly doesn't look logically correct. So I'm rewriting a couple segments relating to that. I'll try to make sure it doesn't break backward compatibility.
 

Harlay

New member
The error message is still "Undocumented".

I have new found.
The NTPADXP has an option "scan mode":

1, best for speed (default)
2, best for response.

When I checked option 2, the "test rumble" will work normally. the "constant force" and "ramp force" is different I can feeling. If I click it again, the error message will also popup and the pad will also rumble.

BUT, the "save" button will crash and the game is no rumbe either.

I don't know if this can help you.
 
Last edited by a moderator:
OP
R

rabiddeity

Plugin Hacker
Okay. I'll run over it really close this weekend to try to fix that crash on save bug. In the meantime... hmm... try deleting this registry key:
HKEY_CURRENT_USER\Software\NRage\DEBUG

I've made a registry script file to do this for you:View attachment 33303

Just run and "import" the registry settings file.

To make sure the save bug is related to rumble settings and not gamepad settings, please first set your gamepad buttons, THEN hit "Save". Now open the config again, set to Rumble, select "None", and "Save". Finally, open config, select your rumble device, and "Save". That's three steps. If it fails, please tell me which step it fails at.

If you cannot Save these settings, please try to "Save Profile". If that works, please post that controller config file to the board in a ZIP file.

Thanks for your patience. I WILL fix this!
 

Top