LilyPad

From PCSX2 Wiki
Jump to: navigation, search

LilyPad is a Windows gamepad plugin for the PCSX2 emulator. It is written by the plugin author ChickenLiver[1] who keeps the official thread updated with the most recent version of the plugin. As of December 2010 the current version is 0.10.0 and is fully working.

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.


Quick guide to the settings

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 (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 the dll will not be renamed, 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.


Troubleshooting advice

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. Window messaging is recommended for keyboard or mouse. If using an Xbox 360 controller, it is suggested to disable DirectInput for other devices, at least while binding the controller's buttons.

If having 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". It needs to be detected before the emulator can use it. 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. If they are, post on the official thread as complete a description of your issue as possible: device type, model number & info, 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 asked for it.

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


Miscellaneous

Pressure-sensitive buttons

  • Most 3rd-party controllers are good enough for LilyPad; however, a select few games rely on pressure sensitive buttons, a feature not included on the vast majority of gamepads. Your average Logitech or Saitek pads do not support this feature - this is a different from thing from pressure sensitive triggers.
    • As of February 2011, the only confirmed gamepad to support actual pressure sensitive buttons working with LilyPad is the official Sony PS3 Dualshock 3, which requires a separate .dll download to get working on a PC. (If you have made this work please post instructions here, thanks.)
  • Many people confuse pressure sensitivity, so here is a test for button pressure sensitivity:
    • Open the LilyPad plugin settings by going to the PCSX2 menu and selecting Config --> Controllers (PAD) --> Plugin Settings.... At the LilyPad plugin popup, select your gamepad from the list of detected controllers in the "Device Diagnostics" box in the lower left then click the "Test Device" button. (This list of controllers will also likely include your keyboard and mouse.)
    • A small popup window will appear, showing a list of all the gamepad's buttons as well as their current state. 0.000 = indicates unpressed, 1.000 = indicates fully depressed.
    • Roll either analog stick around. See how the values change from 0.000 to 0.xyz, with the .xyz values shifting incrementally. These changing .xyz values show how the plugin detects different changes in angle as you move the analog stick around.
    • Now press any of the buttons normally used by games, i.e. the triangle/square/cross/circle buttons. See how the values immediately shift from 0.000 = unpressed, directly to 1.000 = pressed. If your gamepad truly has pressure sensitive buttons you will see gradual 0.xyz changes as you slowly press each button, just like the different changes in angle as you move the analog sticks around.
    • If the buttons change from 0.000 directly to 1.000 this proves that your gamepad buttons are not pressure sensitive and are merely tracking the pressed/unpressed state. (If you can confirm your particular model of gamepad does pass this test, please post in this page's Talk Page and give the name + model number of your gamepad.)
  • Of course, this is not a big deal: the vast majority of PS2 titles do not rely on pressure sensitive button presses. However, a few titles do, for example the Dragon Flute playing sequence in Star Ocean 3, or to a larger extent, all three attack buttons in The Bouncer. For the former, a temporary workaround to get past that sequence exists (remap another button as circle but configured to deliver light pressure; for details see the game's page). For the latter simply remapping buttons will not be practical as you need both light/hard pressure styles during the length of the entire game so you will really need a gamepad supporting true button pressure sensitivity.


References

  1. extrapolated from his posting as seen on the Official LilyPad thread at the PCSX2.net forums

If credits are not being attributed to the correct persons please edit the information here. Any misattribution is accidental and largely due to there not being a Who's Who list of PCSX2 developers and contributors.