Skip to content

jdaniellee/psycho_fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Enabling Psychonauts' Official Xbox Controller Support on Steam Deck (or SteamOS/Linux)

This fixes the bugs in Psychonauts 1 under Steam Deck/Linux where Xbox button prompts aren't showing up in the UI, and also control bindings getting lost every time you quit and start the game.

Note that this is for the Steam version of the game (English/North American version - untested with other versions), running under Proton (NOT the Linux release of the game which does not have official Xbox gamepad support and also has all kinds of visual glitches and other bugs, nor the GOG or retail releases which never received Xbox gamepad support).

Quick guide on how to apply the patch:

  1. Make sure to run Windows version of the game via Proton: in the Steam interface, click the gear icon -> Properties -> Compatibility, then enable "Force use of specific Steam Play..." then select a recentish version of Proton (e.g. 10.0. I heard earlier versions have other issues).
  2. Download psycho_fix.zip from the repo (link) and unzip it. Place the dsound.dll file in your game installation directory in Steam desktop mode (The same directory as Psychonauts.exe. Should be /home/deck/.steam/steam/steamapps/common/Psychonauts if you installed on the internal SSD, but may be different if you installed on microsd).
  3. Set custom Launch Options for the game (either in desktop or gaming mode): click the gear icon -> Properties -> General, scroll to the bottom, then set it to: WINEDLLOVERRIDES="dsound=n,b" %command%
  4. As for Steam Input layout, use the Official Steam Deck one, or generic gamepad (though you may still need trackpad to navigate the options menu). Do NOT use community layouts because they're mostly rebinding buttons to mouse+keyboard controls to try and bypass the bug!
  5. Run the game. If this is not your first time running the game, then you likely have broken gamepad bindings from the last time you played the game, so go into options, and set action bindings to 'Defaults'. You'll then see Xbox gamepad icons show up (as shown in the image below). Hit 'Ok' and you're all good now.
psychosteam

Here's explanation of what the problem was, and what my fix does:

For some reason, this game seemingly funnels every input through GetKeyboardLayout() and MapVirtualkeyEx() Win32 API calls, not just for keyboard but also for gamepad event ids (unintentionally I assume). When MapVirtualkeyEx() processes the gamepad events, they get completely mangled. This happens when the game writes out the .ini file that stores the bindings, which is why the bindings get lost when you restart the game (because it's reading in broken .ini file). And it also likely happens when it's deciding which button icons to draw, which is why the on-screen button prompts are messed up.

This dsound.dll wrapper changes the jump instruction at 0x4B9B in the code section of the game (though it will try and search in case it's not at the exact spot) to bypass those API calls so the button ids remain intact, fixing both issues. I assume this bug is more prevalent on Proton than on Windows due to differences in how these calls are implemented (not sure, but I've seen some people online complaining about similar issues on Windows).

I don't think my hack breaks anything - maybe if you're using non-English keyboard it might misinterpret some keys, but since I want play with gamepad exclusively that's fine by me...

To build from source:

From mingw32 build environment, simply run make.

What if you want to install other mods?

I actually decided to wrap dsound.dll instead of dinput8.dll because I didn't want conflict with other mods that use dinput8.dll. If you're overriding both DLLs, set the launch options to WINEDLLOVERRIDES="dsound,dinput8=n,b" %command%.

L3 and R3 buttons don't seem to have correct button icons?

Actually, this issue is present in unaltered game running on native Windows as well. I think they forgot to update textures for L3 and R3 when they originally released it on Steam.

About

Fix Psychonauts gamepad issues (Xbox button prompts not showing up in the UI and bindings getting lost when you quit and start the game) on Steam Deck

Resources

Stars

Watchers

Forks

Packages