LilyPad 0.10.0
#1
LilyPad 0.10.0 (r1826) is a Windows pad plugin. I'll update this post and bump the thread when I release new versions. See bottom for changelog. Note that when upgrading from a version earlier than 0.9.5 to 0.9.5 or later, you'll lose all old bindings. When updating to 0.10.0 from a version prior to 0.9.11, you will lose vibration settings, and some pad-specific settings on the main page, but shouldn't lose anything else.

C++ source can be found on the PCSX2 svn.

LilyPad Documentation

Overview
Keyboards/Mice/DirectInput/XInput/direct DualShock 3 connections are all supported. It supports multiple devices of all types, and devices of different types can be mixed and matched. Sensitivity can be adjusted. Force feedback is supported. Multiple keys/buttons/axes can be bound to the same PS2 button, and one key/button/axis can be bound to multiple PS2 buttons. Keys can be mapped to the analog sticks. Axes can be mapped to buttons. Pressure sensitive buttons and other single-direction axes (Like foot peddles) are also supported. Screenshots and LilyPad itself are at the bottom of the post.

Troubleshooting
If you experience delayed response to input, make sure PCSX2's priority is set to normal or lower. Also, make sure vsync is turned off. Vsync can cause PCSX2 to run ahead of the GS, so it appears input is lagged, when it's actually the GS that's behind.

If having trouble with the keyboard or mouse, try changing modes. I recommend Window messaging for keyboard or mouse. If you're using an Xbox 360 controller, I suggest disabling DirectInput for other devices, at least while binding the controller's buttons.

If you have trouble getting some of the buttons on your gamepad/whatever working, try rebooting (If you haven't rebooted since installing the device). A number of people have reported that this resolves some problems.

Also, if you run into any trouble, make sure you've installed any software that comes with your game pads. Even if the pad partially/mostly works without the drivers, force feedback, for example, may well require the drivers be installed.

More generally, if you have trouble with several plugins not being detected by PCSX2 at all, try setting your plugins directory in the configuration screen, even if it appears to already be set correctly.

If you have an issue with a controller, first make sure you can see it under "Device Diagnostics". If it's not there, probably nothing I can do. Make sure the corresponding API is enabled. If it is listed, double click it and see if the object(s) you're having trouble with are listed and being read correctly. Tell me if they are and give as complete a description of your issue as possible: Device type, device control that has issues (d-pad, button, pressure sensitive button, axis, etc), if you can't bind the control or if the problem is only in game, etc.

Logging is generally only useful if you only have issues with one game and everything else works fine. Simplest not to bother unless I ask for it.

If you're having trouble with multi-tap, try enabling all pads. Not all games like my pad disabling code, no clue why.

Basic Control Configuration
The input API sets the Microsoft input API LilyPad uses to read input. Mice and keyboards both have 4 input modes. The modes are: Windows messaging, raw, DirectInput, and disabled. Windows messaging is the recommended mode for keyboards and mice, though any mode except disabled should be fine for most people. You must set a keyboard API other than disabled if you want PCSX2/GS hotkeys to work.

Raw mode distinguishes between multiple keyboards/mice under XP/Vista, but does not support horizontal mouse wheels and won't distinguish between right/left control/shift/alt keys (And doesn't work under w2k and w9x). DirectInput mode is pull-based while the other two methods are pushed-based. Only DirectInput provides support for more than 5 buttons on a mouse.

Other devices (Game devices, certain extended keyboard keys, etc) are only available through DirectInput, except Xbox controllers, which can work through XInput as well. DualShock 3 controllers are now also supported through direct connections, allowing LilyPad to directly access all pressure sensitive information.


To configure bindings, first you need to set which APIs to use for keyboards/mice/other devices. Then just go to the tab for the appropriate pad. If you switch input APIs after binding controls, the bindings for the old input mode will be hidden, but will reappear if you switch back. Direct Input devices have a prefix of "DX" ("DI" looks odd), raw devices are prefixed by "Raw", and Windows messaging devices are prefixed by "WM". Press the button corresponding to the button/axis you want to bind, and then press the button/jiggle the axis you want to bind it to. Bindings are sorted first by device, and then by object id.

"Flip" inverts a button or axis, making down up and up down. Cases where you'll want to use it are very rare. Sensitivity sets how hard an axis or button is pressed. Note that setting the sensitivity of PC button bindings only really has an effect for PS2 analog sticks or when playing a game with full DS2 pressure sensitivity support. I'm not sure how the actual dual shock works, but I currently only say a key is down when dual shock pressure is at 50% of maximum or more. What the default sensitivity value of "1.000" means depends on the device itself. The default is high enough that relative axes (Which are primarily used by mice) are generally either considered fully up or down. For absolute axes (And force feedback devices), which are used by most game devices, a value of 1.0 should map the device's extreme values to the extreme values of a stick/pad.

"Turbo" presses/unpresses the button every other poll.

For all 3 vertical axes, down is positive and up is negative. This agrees with windows screen coordinates, and mice and joysticks generally work as expected if you bind vertical to vertical. For some other axis types, however, this may result in flipping up/down. In particular, if you bind a mouse wheel to a vertical axis, you'll need to flip the axis for mouse wheel down to act like down.

To configure force feedback, select the device you want to bind and then press which dualshock2 motor you want to bind it to. When the effect is selected, you can enable/disable individual motors for the effect. First two motors are automatically enabled for any effect, only up to 6 motors will be displayed. Note that for some devices, to get the second motor to work, the first motor must be enabled as well, even if it has 0 force. For other devices, to get some motors to work, previous motors much be disabled for that force. For yet other devices, you have to change the effect to trigger other motors. The slider sets the force used when an effect is triggered. The default value of 1.0 maps the maximum PS2 vibration to the maximum DirectInput/XInput vibration. Flip flips the direction of the effect axis. This most likely will have no noticeable effect. Once a force feedback axis is configured, you can click "Test" and the axis will then vibrate at the maximum possible value a game can set it to. Note that the small motor is only either off or on at max, while the big motor's vibration can be set from 0 to 255.


Special button bindings
The "Mouse" button lets you bind a key to pad 1 or pad 2 that releases the mouse. This makes the cursor visible and lets you move/resize the emulator window. Alt-tabbing to another application also makes the cursor visible, but focusing the emulation window hides it again. Note that though the binding appears on the page of a particular pad, pressing the button affects all mice.

The "Lock Input" button locks the current state of the pad. Any further input is handled normally, but the initial pad state is the locked state instead of a state with no buttons pressed. Pressing it again releases the old pad state, if the old pad state had any keys pressed. Otherwise, it's released automatically.

"Lock Direction" does the same thing, except it only applies to the d-pad and analog sticks. Pressing this when all input is locked unlocks only the pad and sticks. Pressing it again will lock them again, keeping the buttons locked. "Lock buttons" does the same thing, only with the opposite set of controls.

Pressing "Lock Input" when only half the input is locked (directions or buttons) will lock the other half, leaving the already locked half still locked, and in its old locked state.

The "ignore key" button both attempts to block the specific key(s) you give it and does not pass them on to PCSX2. It currently cannot block the windows key (I'm not sure why). It was implemented primarily to prevent passing F7 to the GS plugin, which I occasionally hit when playing with graphics options and can cause PCSX2 to crash. Ignored keys are listed with pad 1's bindings. If an ignored key is also bound to a command, the command may or may not be triggered. The ignore button works like most of the other buttons: Press it and then the key to be ignored. You do not have to configure ignored keys again when you change the keyboard input mode.


Other options
"Start without mouse focus" starts the plugin without the mouse focus and hiding the cursor. Mainly useful for people who only occasionally use the mouse. Equivalent to just pressing the mouse button whenever you start the emulator.

"Always hide cursor" is pretty self-explanatory. May be removed in a future version, as it's no longer too useful.

"Allow binding multiple PS2 controls to one PC control" is pretty self-explanatory. Allows one control to be bound to multiple commands. One control can be bound to commands on both pads as well. The sensitivity of each force feedback axis can be set independently as well, by binding them independently. With this option disabled, old bindings will automatically be deleted if they conflict with a new one.

"Port # Multitap" enables/disables multitap for a given pad. Does not work with PSX emulators, requires PCSX2 SVN 893 or so or higher.

Pad mode pulldown sets whether a pad is disabled, a DS2, or acts like a guitar. Disabled pads send no input to PCSX2, have no config tabs (Though their bindings are not cleared), and, with newer versions of PCSX2, the emulated PS2 acts as if the pads are actually unplugged (With older versions of PCSX2, there's no way for the pad plugin to do this).

"Use analog mode whenever possible" will switch a pad from digital mode to analog mode whever a pad is set to digital mode, if the pad's mode is not locked. This is handy for the lazy, who don't want to have to hit the analog button whenever they start the emulator for games that support but do not automatically enable analog mode, and for loading states in games that get upset when you load a state before the pad is initialized. May cause issues with some games, especially very old ones, and when using older versions of PCSX2.

"Refresh" will update the list of DirectInput devices. As I autodetect when new devices are plugged in, this option generally shouldn't be useful.

Double clicking a device or selecting "Test Device" will display a continuously updated list of the state of all objects on the selected device. Devices not currently enabled in the API selection list at the top are not displayed.


"Use GS thread" will use the GS thread for getting DirectInput device state and calculating the state of all pads. Option may affect speed, either way.

"Disable Screensaver" will disable the screensaver (And entering low power monitor mode) when the emulation window is in the foreground. This is primarily intended for people using neither mouse nor keyboard, as game device input does not prevent the screensaver from popping up.

"Local volume control" uses Vista's per-app volume control to use volume control keyboard buttons or wheels to affect PCSX2's volume only.


The options under "Hacks" are a bit hackish, and may not work with all graphics plugins or emulators (PSX emulators, in particular). I do almost all my testing with ZeroGS. That having been said, the worst that can result from using them is an emulator crash (Not a system crash) when starting/stopping the emulator. Shouldn't cause any issues in game, and crashing behavior should be consistent (Either always does or never does).

"Send escape on close" sends an escape message instead of closing the window when you try and close the graphics windows. This prevents bad things from happening when you try and close the GS plugin window. After the first attempt to close the window, however, PCSX2 closes the pad plugin. As a result, attempting to close the window while the emulator is not actively running still isn't a great idea.

"Close emulator on close" kills the emulator instead. I don't recommend this, as I'm not sure how well everything cleans up after itself when you do this.

"Safe fullscreen exit on escape" tries to hide the GS Window when you press escape and the window is in full screen mode. Experimentally, this results in both GSDX and ZeroGS making the Window non-fullscreen. Not the perfect workaround, but should prevent issues when you press escape and the window is full screen.

"Save state # in title" attempts to put the number of the currently active save state in the window's title.

"Guitar Hero 2 Hack" see next section.

"Load/Save Bindings" loads/saves the current configuration from/to a file.

Notes
As with all pad plugins, you should set both the pad1 and pad2 plugins to LilyPad so LilyPad doesn't fight with another plugin for control of user input devices. If you really need to use two different pad plugins for some reason, and one is LilyPad, disable LilyPad's keyboard handling so that the F-keys, used to control the emulator, don't behave as if you always press them twice.

Some PSX emulators (At least PSXeven) require pad plugins to be named pad*.dll. To use LilyPad with those, you'll have to rename the dll. The most popular two psx emulators don't use pad plugins and LilyPad is really aimed at use with PCSX2, anyways, so I'm not going to rename the dll, to minimize confusion.


Guitars
To make a pad work as a guitar in Guitar Hero or Rock Band, select the Guitar from the dropdown for that pad and rebind the controls. Note that you must start the game with the checkbox selected. Toggling it later won't work.

Guitar Hero 2 has some sort of additional check to prevent the use of 3rd party guitars. I don't know how to convince it I'm a real guitar. As a workaround, there's a GH2 hack option in the hacks section. Check it and the pad's guitar setting to play GH2 with a guitar. You'll have to press the strumbar and the frets at the same time to navigate through menus. This is a result of the GH2 hack causing the guitar to identify itself as a pad, but behave more like a guitar in-game. There's no reasonable workaround I can do for this, unless I learn how to convince GH2 I'm really a guitar. A PCSX2 patch file might be possible, however.

Particular thanks to cottonvibes for info on the PS2 guitar, and to gabest for finding a bug.

Setting up a DualShock 3 Direct Connection
You must have libusb installed for this to work. See http://forums.pcsx2.net/thread-7582.html for more details. sixaxis64.exe is not needed, but the libusb drivers are required. Not sure if the "Add hardware wizard" step is needed or not, I suggest you do it, just in case. Note that those are 64-bit instructions. It's simpler to install and configure on 32-bit OSes. You must press the PS button while a game is running or binding controls to initialize the DS3. Once it's been initialized once, a single light should turn on (Pad 1 light if you only have one plugged in), and you shouldn't have to do it again until you unplug the controller or reboot (Even if you restart PCSX2). It may take several seconds to start working. When you unplug it from the pc, all 4 lights will blink for a while, and it may rumble once or twice. Not sure how to prevent the rumbling.

Recent Changelog
0.10.0
* DualShock 3 direct connection support added. Supports several tilt axes and analog input from all buttons that support it. Probably won't work with six-axis controllers, as I don't have one to test on. No idea about bluetooth support.
* Multi-tap support added. Requires relatively recent versions of Pcsx2 (SVN 893 or higher recommended). Note that this doesn't work with the latest betas with wxWidgets, as the option is going to be added to Pcsx2's interface, to allow use of memorycards on the emulated multi-tap as well.
* Pad save state stuff should be a little more robust. As a result, should wait until pad is initialized before loading savestates made with 0.9.11, just as one should have done every time with 0.9.10 or earlier, so shouldn't really cause any issues.
* Miscellaneous binding improvements.
* Pressure sensitivity stuff may work better, now based on DS3 behavior.
* Messed up list of bindings when mouse API enabled and "Start without mouse focus" is set, and enter config screen after running PCSX2 fixed.
* Multi-threading vibrating while plugging in/unplugging a device bug fixed. Sure a whole lot of people ran into this one. Smile
* Logging bug fixed.
* Poll devices at most only once every 15 milliseconds. This will make the pad plugin less likely to cause slowdowns while fast forwarding games, though it will may make turbo behave less than perfectly in the same situations. As most people cant press and release a button even a mere 5 times in a single second, shouldn't cause issues unless a game is running at least 10 times faster than it would on a PS2.
* Defaults for new force feedback bindings should work for most devices.
* Modified force feedback axis sorting.
* Improved keyboard queue handling slightly.
* Minor config screen fixes.

0.9.11
* Note that force feedback bindings will be lost when upgrading, due to some changes in the ini format.
* Added PADfreeze function so no longer have to wait for pad to be initialized before loading states with any games. Requires PCSX2 r791 or later for this to work.
* Hack to display current save state number in window title.
* Removed "Enable pressure sensitive buttons" button. Now attempt to autodetect when you're trying to bind one. If that fails, there's also a pulldown with similar functionality.
* Added Vista-only option that uses Vista's current process-only volume control stuff to make volume keys/knobs only affects PCSX2, when PCSX2 is running and GS window is in front.
* Fullscreen escape hack should no longer break GSDX+DX9.
* Removed all "axis" buttons, as they're no longer needed in any situations.
* Can select multiple bindings to set their sensitivity/turbo values at once.

* Removed extra buttons that were supposed to be hidden from the guitar configuration screen. 0.9.5's new force feedback stuff caused them to no longer be hidden.
* Display force feedback axis names
* Disabled/bindingless DirectInput devices are no longer instantiated except during device enumeration in an attempt to circumvent potential DirectInput/XInput infighting.
* Bug when refreshing devices when device added/removed fixed.
* Display current version in config screen title and about dialog.
* "GS Thread updates" disabled and grayed out for PSX emulators.
* Fixed a pair of bugs with flipped controls and sensitivity > 1.
* Fixed a bug with only using half the range of pressure sensitive buttons.
* "Ignore keyboard" removed from device list. Testing it didn't work and wouldn't serve any real purpose even if it did. "Test device" is really only intended for DirectInput and XInput devices, anyways, though it should work fine for everything else listed as well.
* Fixed a couple issues with disconnected devices.
* Removed some unnecessary mouse capture code for mouse raw input.
* Renamed some options in the menus to be more end user friendly.
* Other miscellaneous interfaces changes.

0.9.9
* Will no longer hide the cursor when testing a force feedback binding and mouse mode is not set to disabled.
* Bug that required the GS window to be unfocused and then focused again for keyboard input to work when only one pad plugin was set to LilyPad fixed.

0.9.8
* Creating a new force feedback binding while testing an old one will no longer cause a crash.
* Pressing a button after clicking on one of the bind axis buttons will no longer result in a crash.
* Disabled pads now have their tabs hidden.
* Sensitivity for DirectInput relative axes was set so low they were unuseable. Fixed.
* Replaced "Start in analog mode" with "use analog mode whenever possible". New option will auto switch pads from digital to analog after a mode change whenever the pad's mode is not locked.

0.9.7
* Fixed bug that caused the config screen not to save guitar or autoanalog settings.
* DirectInput and Raw Input keyboard modes should no longer prevent GSDX from reading keyboard input for itself, so F5, etc, should work.
* A potential crash issue when unfocusing the GS window when read input in GS thread is disabled should be fixed.

0.9.6
* Fixed a bug that would cause it to fail to reclaim device input when resuming emulation.

0.9.5
* Major rewrite of code to read input, so all old bindings will be lost.
* Can bind half-axes to buttons.
* XInput support added, flip button now inverts an axis/button (up means down and down means up).
* Turbo added.
* Binding now works as people expect, when multiple binding is disabled.
* Removed 1D/2D options under hacks, as the FF config screen lets you do everything yourself.
* A couple warning dialogs added.
* Workaround added for a few DirectInput issues.
* I now queue all key presses, so PCSX2 will eventually be informed of any key press, unless you press too many at once. Overkill, but doesn't hurt.
* Multiple binding and device testing now works for all input modes. Should auto refresh device list when devices are attached/removed (Both in game and at config screen).
* Will attempt to maintain bindings across OSes or when you move a device to another USB port, giving it a new ID.

Think that's about it. Feel free to redistribute the plugin however you like.


Attached Files
.rar   LilyPad 0.9.4.rar (Size: 81,71 KB / Downloads: 64.738)
.rar   LilyPad 0.9.4 source.rar (Size: 56,01 KB / Downloads: 8.954)
.rar   LilyPad 0.9.5 source.rar (Size: 47,92 KB / Downloads: 4.881)
.rar   LilyPad 0.9.5.rar (Size: 29,17 KB / Downloads: 5.340)
.rar   LilyPad 0.9.6 source.rar (Size: 47,92 KB / Downloads: 5.787)
.rar   LilyPad 0.9.6.rar (Size: 29,18 KB / Downloads: 7.007)
.rar   LilyPad 0.9.7 source.rar (Size: 47,79 KB / Downloads: 13.382)
.rar   LilyPad 0.9.7.rar (Size: 28,8 KB / Downloads: 120.703)
.rar   LilyPad 0.9.8 source.rar (Size: 45,02 KB / Downloads: 8.016)
.rar   LilyPad 0.9.8.rar (Size: 28,76 KB / Downloads: 9.327)
.rar   LilyPad 0.9.9.rar (Size: 29,09 KB / Downloads: 10.779)
.rar   LilyPad 0.9.11.rar (Size: 32,73 KB / Downloads: 24.952)
.rar   LilyPad 0.10.0 (r1826).rar (Size: 37,12 KB / Downloads: 190.115)
Reply

Sponsored links

#2
Welcome man Smile Yeah we have an issue with nicknames longer than 10 chars and what ticks me off is that most want about 12 chars Tongue
Anyway,can't wait for a new version! Also,I remember you talking about the pad specs needing a rewrite to support other functions,you can always talk about it with the playground team and see what you can pull off together Wink
Oh and about your post: you can copy the coloring from vbulletin,just remove the quotes from the color,like color=blue instead of ='blue'
[Image: newsig.jpg]
Reply
#3
The specs thing was in response to a question about multi-tap support, which I'm not terribly interested in doing at the moment. Also mentioned it in response to a couple posts about guitar support, before I realized (Or, more accurately, cottonvibes told me) guitars identified themselves as normal pads.
Reply
#4
Ah I see...arcum is also interested in porting your plugin to linux,we'll see how it goes Smile
[Image: newsig.jpg]
Reply
#5
Am I?

Actually, lilypad is using all Microsoft apis, which would make a port unlikely. I am, however, in favor of including source to all the plugins necessary to run pcsx2 in the playground svn, on both Linux and Windows, and I doubt a Windows build would be complete without Lilypad...
Reply
#6
Lol sorry then,I misinterpreted your other post Wink Linux users are stuck with ZeroPad correct? It would be nice if they could have a more advanced plugin like this one,but I understand it can be pretty complicated
[Image: newsig.jpg]
Reply
#7
I'll admit, it would be nice. I do use Windows occassionally, and when I do, I'm usually using Lilypad. It's just that a port would involve ripping out all the Microsoft api, and replacing it with a Linux api, and ripping out the gui and replacing that, and I'm not sure what would be left of the original code... Smile

Most likely pad plugin to be ported would be MegaPad, as I recall, because that was using SDL, which *is* dual platform, and because the author was working on a Linux port back in August.

Most likely plugin for me to port to Linux (though no promises; it's just the one I'd be most interested in getting working) would be MegaDev9.

Oh, and just as a side note; I have looked at how joystick support is done in Linux before; I had it mostly hacked into ZeroPad when Zerofrog released the update to ZeroPad that made it unneccessary. It's just as well; I had everything mostly working, but it was very unreliable, and I'm sure I was missing something subtle.

That was actually the first time I started playing with the pcsx2 code, as I recall...
Reply
#8
I've periodically considered rewriting LilyPad so it's a bit easier to work with... Surround each of the APIs I use with a single wrapper. Would make for less messy code, though my config screen would still be awful. It'd be a fair bit of work, however, so I never got around to it, and looks unlikely that I ever will. Even if I did, it'd be a pain to port to Linux because of the config screen.

The main reasons to do this would be to add XInput support (Which I've periodically considered, despite my repeated bashing of the API), Linux support (Which I don't use a whole lot), and to reduce the effort needed to add stuff, as I basically have 3 copies of all my input code: One for DirectInput, one for Windows messaging, and one for raw input. First two have been taken care of by other plugins while I was putting it off. Last only matters when I add features, and the only feature I'm considering adding at the moment is turbo.

You are, of course, welcome to add a copy of the LilyPad source to the playground SVN.
Reply
#9
Yeah, for a Linux port, first thing on portability would be getting as much of the Windows code in windows-specific files. Separating out the apis is a good idea, too, because you'd be adding one or two.

The gui would be tricky. Most of it could be done in glade, but trees can be compilicated in gtk, and I've rather been putting off converting the areas in pcsx2 that I think would be better as trees.

Oh, and the choices on Linux support would basically be raw input or sdl. As it happens, I know where the documentation for both is if you need it, since I've looked at both in the past, and worked with the raw input api a bit.

As far as adding the source, thanks! We are still talking about what plugins to add in, so it's still up in the air, though. The whole discussion started because I'm trying to get all the Linux plugins added in svn... Smile
Reply
#10
Could someone with an Xbox 360 controller installed try this version and see if the controller is detected and if they can bind all its controls? Everything should be bound as a button, not an axis. Disable DirectInput first, just to make sure I'm using XInput to bind the buttons instead of DirectInput.

Note: Despite the fact the config screen looks almost identical, this is a fairly significant rewrite, and will destroy all your bindings if you have an older LilyPad config file. It still needs to undergo a fair bit of testing, so I don't recommend actually using it to play games yet. I just want to see if my XInput code is working at all.

<Attachment outdated, removed>
Reply




Users browsing this thread: 6 Guest(s)