Wednesday, May 14, 2014

How to Force a Gamepad to Work with Saints Row 2

I purchased Saints Row 2 off Steam only to discover my PlayStation DualShock controller doesn't work out-of-the-box with it.  After spending an hour experimenting with it, I figured out how to make it work.

The problem is the axes are screwed up.  The game assumes there's an Xbox 360 controller, which has more than four axes.  It also assumes the axes do different things or are in different positions.  This causes the uncontrollable scrolling effect when starting up the game.

How Saints Row 2 recognizes controller input:
Axis 1: Non-existent.  Doesn't correspond to any button or axis on a DualShock.  (May also be a default setting for unused axes.)
Axis 2: Left analog stick back/forth movement.  (Y-axis)
Axis 3: Left analog stick left/right movement.  (X-axis)
Axis 4: Right analog left/right movement.  (Z-rotation +/-)
Axis 5: Right analog up/down movement.  (Z-axis +/-)
An almost working controller configuration.
If it weren't for Axis 1, this would work perfectly.
The in-game controller settings only allow the user to assign Axes 1-4 when using a DualShock controller.  Axis 1 doesn't work with the DualShock.  Axis 5 does work, but the user can't assign it.  However, hex editing the file "input.bin" can force the game to use Axis 5.
Changing controller configuration has never been more annoying.
The red number "04" corresponds to "Axis 5".
The game will play perfectly with this setting, but changing gamepad input with the in-game menu causes graphical glitches.
Messed up menus.
It sort of works.
Simply switching 0x2C4 in input.bin back to "00" fixes this and allows the player to change buttons again.

Here are the steps to get a DualShock or similar controller working with Saints Row 2:

  1. Start game with controller off or unplugged (to prevent scrolling problem).
  2. Set Movement X/Y to Axis 3/2 and Camera X/Y to Axis 4/1.
  3. Exit game.
  4. Open input.bin with a hex editor (such as HxD).  File should be located in "D:\Documents and Settings\{username}\Local Settings\Application Data\THQ\Saints Row 2".
  5. Change address 0x2C4 (row 0000002C0, column 04) from "00" to "04".  Make sure it overwrites (replace characters) and doesn't insert (add characters, lengthening the file).
  6. Save and start up Saints Row 2.
  7. If you need to change the controller's other buttons (such as changing fire button to a shoulder trigger), repeat steps 4-6, but change the hex value from "04" to "00".  The in-game menu should work then.  (Then change back to "04" to get the camera working again.)  You can also just keep the hex editor open, but the file might change if you make input changes via the game's interface.  The game needs to be restarted with every change via hex editor as well.

If this doesn't qualify as "forcing", I don't know what does.