Ori and the Blind Forest

Ori and the Blind Forest

View Stats:
BLiTZ Jul 3, 2015 @ 5:39pm
[Tool] Remap controller buttons on non-XBOX gamepads
Please note that Ori and the Blind Forest: Definitive Edition supports native controller remapping. Use this tool only if you have original, non-Definitive edition.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Info

As many of you know it's almost impossible to play Ori with non-XBOX gamepad: all buttons are messed up and Unity's built-in remapper doesn't work properly (you can't rebind jump button). This tool is intended to fix it.

How it works

The included PowerShell script will replace a part of the Ori's code contained in the Assembly-CSharp.dll file. This new code will query the Unity engine for the remapped buttons, instead of original ones, requested by game.

Technical details

The modfied code is in the MoonInput.GetButton(string buttonName) method in the Assembly-CSharp.dll.

Original:

public static bool GetButton(string buttonName) { return Input.GetButton(buttonName); }

Patched:

public static bool GetButton(string buttonName) { // array of the remapped button's numbers, generated by PS1 script from ini file string[] strArray = new string[] { "1", "2", "0", "3", "4", "5", "8", "9", "10", "11", "6", "7" }; Match match = Regex.Match(buttonName, @"^(Joystick\dButton)([0-9]|1[0-1])$", RegexOptions.Singleline); if (match.Success) { return Input.GetButton(match.Groups[1].Value + strArray[int.Parse(match.Groups[2].Value)]); } return Input.GetButton(buttonName); }

How to apply patch

  • Download JoystickTest application[www.planetpointy.co.uk]
  • Go to https://github.com/beatcracker/Ori-Controller-Remap
  • In the bottom right corner click Download ZIP
  • Unblock ZIP file[blogs.msdn.microsoft.com] before unpacking
  • Unpack downloaded ZIP file
  • Go to the Ori-Controller-Remap-master folder
  • Open Ori_Controller_Remap.ini file in Notepad. This file contains controller button mappings for known controllers (Cyborg Rumble Pad, Logitech Dual Action, etc.) and one for you to edit (Your Controller Name).
  • Run JoystickTest application
  • Punch buttons on your controller, note their numbers in JoystickTest, edit ini file accordingly
  • Replace Your Controller Name with any text you like (your controller name, your pet name, your maiden name - it's all up to you).
  • Save Ori_Controller_Remap.ini file
  • Double-click Ori_Controller_Remap.cmd file, it will launch PowerShell script
  • When asked, select configuration you've edited earlier in the ini file
  • Press any key and wait for script to patch your Ori with new controller mapping

How to remove patch

  • Go to the Ori instalation directory
    • Steam: right-click game in library → Properties → Local files → Browse local files
  • Go to the ori_Data\Managed folder
  • Delete Assembly-CSharp.dll
  • Rename Assembly-CSharp.dll.bak to Assembly-CSharp.dll
— Or —
  • Right-click game in library → Properties → Local files → Verify integrity of game cache

Troubleshooting

Q: I've got a red text message saying: Compiler executable file csc.exe cannot be found.

A: You have to install .Net Framework 3.5. For Windows 7 and higher you can do this via Windows GUI or command line:

Command line
  • Run cmd.exe or PowerShell.exe as Administrator
  • Copy/Paste text below and press Enter:
  • DISM /Online /Enable-Feature /FeatureName:NetFx3 /All

Windows GUI
  • Press Windows Logo + R keys on the keyboard.
  • Type appwiz.cpl in the Run command box and press ENTER.
  • In the Programs and Features window, click on the link Turn Windows features on or off.
  • Check if the .NET Framework 3.5 (includes .NET 2.0 and 3.0) option is available in it.
  • If yes, then enable it and then click on OK.
  • Follow the on-screen instructions to complete the installation and restart the computer, if prompted.

For Windows Vista and below you have to install it from Microsoft website: Microsoft .NET Framework 3.5 Service Pack 1[www.microsoft.com]

Q: Script worked for other buttons, but I stil can't use Triggers on my gamepad

A: I don't know why it happens, but some users reported that this could be fixed by using JoyToKey[joytokey.net].
  • Quote from Steam user Interceptor: Open JoyToKey program and hit the RTrigger button on your controller, it will light up the corresponding line in Joy2Key where you can click this specific button and assign it to Shift on your keyboard. So essentially when you're pressing that button on your controller you're holding the shift button on your keyboard (and thus allowing you to grab/slide)
Q: I've changed input settings in Unity's built-in remapper (held Shift while starting Ori), but now I want to reset it to default. How can I do it? There's no option to reset.

A: Just delete all keys starting with __Input in this registry key: HKEY_CURRENT_USER\Software\Microsoft Studios\Ori And The Blind Forest.

Q: Script can't find my Ori installation (Assembly-CSharp.dll file)

A: Are you running non-Steam version of Ori? Script uses registry keys created by Steam to locate Ori installation folder. If it can't find it, it looks for the required files in the script folder. So you have to copy those files in the script folder:
  • Assembly-CSharp.dll
  • mscorlib.dll
  • System.dll
  • UnityEngine.dll
Those files are located in the X:\Ori_Installation_Directory\ori_Data\Managed\. After the patch, you have to copy and replace Assembly-CSharp.dll file back to ther Ori installation folder. Three other files are required to build the patch code, but not modfied.

Q: Script doesn't work, produces red text and warnings not mentioned above, etc.

A: Run script, right-click window title, select Edit->Select All, press Enter. This will copy all text on screen. Then post it to the Steam Community or GitHub issues[github.com] and I'll try to help you.

Final note

If the tool works for you, please, post your Ori_Controller_Remap.ini file and controller name to the Steam Community or GitHub issues[github.com], so I can update my script with it.
Last edited by BLiTZ; Jul 15, 2017 @ 4:17am
< >
Showing 1-15 of 69 comments
BLiTZ Jul 4, 2015 @ 9:25am 
Originally posted by #sixty:
How safe is this to use?
Could you elaborate, what are you meaning by "safe"? This is a PowerShell script, so 99% of the code is free for anyone to look into. I had to use Mono.Cecil.Reflexil.dll for the 1% percent part, but it's code available too[github.com]. There is no malicious code in this tool.

If you're asking about VAC, then it's safe - Ori doesn't use it (check it's SteamDB page[steamdb.info]). I've played about six hours with this patch, and made a lot of hex-editing during it's development and everything is fine.
Last edited by BLiTZ; Jul 4, 2015 @ 9:26am
SureShot Jul 6, 2015 @ 5:42pm 
Looked over the code - it seemed fine and even makes a backup in the same Managed folder.

It looks like it bound the keys to my custom gamepad successfully, but unfortunately didn't solve the 'constantly moving left' issue I still had unless I disconnected the controller. Many people have this issue though and I'm not sure what causes it.

EDIT: Fixed by modifying the configuration program after holding shift when you start the game (set Joystick0's Axis 1 and 2 to your left joystick's X and Y axis -- rest don't matter so set it to something unused like your right joystick). That in combination with this fix helped solve all the controller issues I was having.

Thanks!
Last edited by SureShot; Jul 6, 2015 @ 10:18pm
BLiTZ Jul 7, 2015 @ 6:34am 
Originally posted by SureShot:
EDIT: Fixed by modifying the configuration program after holding shift when you start the game (set Joystick0's Axis 1 and 2 to your left joystick's X and Y axis -- rest don't matter so set it to something unused like your right joystick). That in combination with this fix helped solve all the controller issues I was having.

Thanks!
You're welcome. Could you share your ini file and controller name, so I can update the script with it?
Last edited by BLiTZ; Jul 7, 2015 @ 10:53pm
SureShot Jul 7, 2015 @ 9:29am 
Forgot about that.

[TigerGame PS/PS2 Game Controller w/ SuperJoyBox Adapter]
A = 3
B = 2
X = 4
Y = 1
LShoulder = 5
LStick = 11
LTrigger = 7
RTrigger = 8
RStick = 12
RShoulder = 6
Select = 10
Start = 9

However, the RTrigger (the one for grab) didn't work for me despite the fix and I'm not at the point of the game to test LTrigger. The Rtrigger simply didn't do anything. I noticed other people had this issue with Grab not working with certain gamepads in other topics though, so I doubt it's related to this fix.

I had to solve that by using JoyToKey to bind that button to the keyboard's grab (shift). The rest of the buttons worked fine according to the layout I put into the ini.
Last edited by SureShot; Jul 7, 2015 @ 9:54am
BLiTZ Jul 7, 2015 @ 9:41am 
Originally posted by SureShot:
However, the RTrigger (the one for grab) didn't work for me despite the fix and I'm not at the point of the game to test LTrigger. The Rtrigger simply didn't do anything. I noticed other people had this issue with Grab not working with certain gamepads in other topics though, so I doubt it's related to this fix.
Does zoom in\out in map mode works for you with triggers?

P.S. Thanks for the config! Have you not mapped START button or it's just not survived copy\paste?
Last edited by BLiTZ; Jul 7, 2015 @ 9:43am
SureShot Jul 7, 2015 @ 10:00am 
Woops -- messed up a simple copy paste. Fixed.

It looks like the map mode zooms don't work either. Since I bound Shift to my RTrigger, it fixes one of the zooms, but it looks like I'd have to come up with a solution for LTrigger since Keyboard uses different buttons for zoom + charged jump (while controller uses LTrigger for both). I guess I could ignore it or just bind my LShoulder button to CTRL in joytokey so I can keep charged jump as my LTrigger.

Kind of silly we have to do all this but whatever works.
Last edited by SureShot; Jul 7, 2015 @ 10:01am
MonK Jul 7, 2015 @ 3:13pm 
If i knew this before hand i probably would not have bought it untill this was fixed. Hope devs will add a rebind option or something. Would be pretty dissapointed if i bought it at full price.

It does detect my non xinput controller but it's far from perfect as the button layout is all messed up. Unplayable if your not using a xbox controller wich i don't plan on owning purely for the fact that i dislike it. A simple rebind option probably solves it. I expected more from a game with this reputation. ah well...

Thx for the info will try later.
BLiTZ Jul 7, 2015 @ 11:04pm 
Originally posted by SureShot:
It looks like the map mode zooms don't work either.
I've looked at the code, and R\L triggers are assumed to be on the Axes 9 and 10 (XInput?) or Axis 3 (DirectInput?). This post[answers.unity3d.com] is also confirms that.

Code: public static bool GetButton(XboxControllerInput.Button button, int userIndex = -1)
... case XboxControllerInput.Button.LeftTrigger: { bool leftTrigger = xboxController.LeftTrigger > 20; bool axis = MoonInput.GetAxis(XboxControllerInput.m_joystickAxis9Map[axisUserIndex]) > 0.5f; bool flag = MoonInput.GetAxis(XboxControllerInput.m_joystickAxis3Map[axisUserIndex]) > 0.5f; return (leftTrigger || axis ? true : flag); } case XboxControllerInput.Button.RightTrigger: { bool rightTrigger = xboxController.RightTrigger > 20; bool axis1 = MoonInput.GetAxis(XboxControllerInput.m_joystickAxis10Map[axisUserIndex]) > 0.5f; bool flag1 = MoonInput.GetAxis(XboxControllerInput.m_joystickAxis3Map[axisUserIndex]) < -0.5f; return (rightTrigger || axis1 ? true : flag1); } ...

So, maybe you could try to remap those axes in Unity's remapper and see where it gets you.
Last edited by BLiTZ; Jul 7, 2015 @ 11:04pm
SureShot Jul 8, 2015 @ 7:31pm 
That matches my experience -- when I was messing with the configuration program and had almost everything (except the buttons) set to an unused axis, I noticed moving that joystick caused me to grab things.
Emanate Jul 21, 2015 @ 11:59pm 
Hey, just wanted to say I've tried this fix and it actually works! Where basically no other thing has so far (keyboard bindings, xbox controller, x360ce...) Thanks for the effort on this!
BLiTZ Jul 22, 2015 @ 12:11pm 
Originally posted by Emanate:
Hey, just wanted to say I've tried this fix and it actually works! Where basically no other thing has so far (keyboard bindings, xbox controller, x360ce...)
Yep, I've tried all that stuff too and ended creating my own fix :).

Originally posted by Emanate:
Thanks for the effort on this!
Thanks! Could you share your ini file and controller name, so I can update the script with it?
Emanate Jul 22, 2015 @ 9:55pm 
My Ini:

[Logitech Dual Action]
A = 2
B = 3
X = 1
Y = 4
LShoulder = 5
LStick = 11
LTrigger = 7
RTrigger = 8
RStick = 12
RShoulder = 6
Select = 9
Start = 10

After some experimenting, everything works fine but I /did/ still have to use JoyToKey to remap the trigger buttons. Though from what I've seen that's a problem with the game, not the mapping.
BLiTZ Jul 23, 2015 @ 2:52am 
Originally posted by Emanate:
After some experimenting, everything works fine but I /did/ still have to use JoyToKey to remap the trigger buttons. Though from what I've seen that's a problem with the game, not the mapping.
Thanks for Ini file, I've updated the fix. Also, there is a whole thread dedicated to triggers issue. For non-XBOX controllers, disabling Nvidia ShadowPlay and removing from devices anything, that can pose as joystick (gaming mice, etc) seems to help.
Daedalos Jul 25, 2015 @ 1:26pm 
I ran into a problem: Whenever I try to run this tool, it gives me a warning that Mono.Cecil.Reflexil.dll can't be loaded, although I doublechecked it is there. I even downloaded it separately from GitHub in case the zip was faulty, but to no avail.
BLiTZ Jul 26, 2015 @ 4:42am 
Originally posted by Miburec:
I ran into a problem: Whenever I try to run this tool, it gives me a warning that Mono.Cecil.Reflexil.dll can't be loaded, although I doublechecked it is there. I even downloaded it separately from GitHub in case the zip was faulty, but to no avail.

Not sure why this happens, but you can try to redownload tool and unblock ZIP file[blogs.msdn.com] before unpacking. You can also unblock individual files that way, it's just more cumbersome.

Also, what Windows and PowerShell versions are you running? To get PowerShell version, find PowerShell in your start menu (or modern metro thingy) and launch it. Then type:
$PSVersionTable
and hit enter. It should display something like this:
Name Value ---- ----- PSVersion 5.0.10018.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.34209 BuildVersion 10.0.9800.0 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} PSRemotingProtocolVersion 2.2
Last edited by BLiTZ; Jul 26, 2015 @ 4:58am
< >
Showing 1-15 of 69 comments
Per page: 1530 50