Git Product home page Git Product logo

ori-controller-remap's Introduction

⚠️ 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

  1. Download JoystickTest application
  2. Go to https://github.com/beatcracker/Ori-Controller-Remap
  3. In the bottom right corner click Download ZIP
  4. Unblock ZIP file before unpacking
  5. Unpack downloaded ZIP file
  6. Go to the Ori-Controller-Remap-master folder
  7. 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).
  8. Run JoystickTest application
  9. Punch buttons on your controller, note their numbers in JoystickTest, edit ini file accordingly
  10. Replace Your Controller Name with any text you like (your controller name, your pet name, your maiden name - it's all up to you).
  11. Save Ori_Controller_Remap.ini file
  12. Double-click Ori_Controller_Remap.cmd file, it will launch PowerShell script
  13. When asked, select configuration you've edited earlier in the ini file
  14. Press any key and wait for script to patch your Ori with new controller mapping

How to remove patch

  1. Go to the Ori instalation directory
    • Steam: right-click game in library → Properties → Local files → Browse local files
  2. Go to the ori_Data\Managed folder
  3. Delete Assembly-CSharp.dll
  4. Rename Assembly-CSharp.dll.bak to Assembly-CSharp.dll

— Or —

  1. Right-click game in library → Properties → Local files → Verify integrity of game cache

Troubleshooting


Q: I've got a red text message saying : Can't load Mono.Cecil.Reflexil.dll, press any key to exit...

A: Unblock ZIP file before unpacking


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


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.

  • 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 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, so I can update my script with it.

ori-controller-remap's People

Contributors

beatcracker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ori-controller-remap's Issues

I have error

Join-Path : Не удается привязать аргумент к параметру "Path", так как он имеет значение NULL.

New game Ori DE, missed registry folder

Since the only game version to buy is Ori and the Blind Forest DE, there is new registry folder:
Steam App 387290
Still even with this fix it doesn't work. DualShock 3 (USB), SCP Toolkit/x360ce.

Clarification on Definitive Edition

I'm trying to play Ori and The Blind Forest Definitive Edition with a Logitech Dual Action gamepad.

This tool is pretty high on the list if you search for "ori and the blind forest joystick remap" so I tried it and managed to remap mostly everything except the right trigger, like in #3 .

Then I searched around for more info as remapping with joytokey did not work.

I found out that the definitive edition has two textfiles to remap my controller buttons. With this I was able to remap all my buttons without problems (reverting Assembly-CSharp.dll before of course). I used the numeric values provided in Ori_Controller_Remap.ini .

This should be in the readme.

TL;DR: The definitive edition does not require you to use this tool, and has built in remap support.

Logitech Dual Action, LT and RT assigned to right stick

Hi, I had problem with Logitech Dual Action gamepad, remapping was fine, except left and right trigger assigned to right gamepad stick.

This could be repaired by changing "GetButton" method in "SmartInput.XboxControllerInput". I've done it this way (but this exact code will not work for your tool, as it is already remapped for Logitech Dual Action gamepad):

public static bool GetButton(XboxControllerInput.Button button, int userIndex = -1)
{
    ...old code...
    if (xboxController.IsConnected)
    {
        ...old code...
    }
    else
    {
        switch (button)
        {
        case XboxControllerInput.Button.ButtonA:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton1Map[num]);
        case XboxControllerInput.Button.ButtonX:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton0Map[num]);
        case XboxControllerInput.Button.ButtonY:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton3Map[num]);
        case XboxControllerInput.Button.ButtonB:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton2Map[num]);
        case XboxControllerInput.Button.LeftTrigger:
        case XboxControllerInput.Button.LeftStick:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton6Map[num]);
        case XboxControllerInput.Button.RightTrigger:
        case XboxControllerInput.Button.RightStick:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton7Map[num]);
        case XboxControllerInput.Button.LeftShoulder:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton4Map[num]);
        case XboxControllerInput.Button.RightShoulder:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton5Map[num]);
        case XboxControllerInput.Button.Select:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton8Map[num]);
        case XboxControllerInput.Button.Start:
            return MoonInput.GetButton(XboxControllerInput.m_joystickButton9Map[num]);
        }
    }
    return false;
}

Rewriting "XboxControllerInput.cs" like this should work for you (not tested):

...old code...

namespace SmartInput
{
    public static class XboxControllerInput
    {
        ...old code...

        private static readonly string[] m_joystickButton10Map = new string[]
        {
            "Joystick1Button10",
            "Joystick2Button10",
            "Joystick3Button10",
            "Joystick4Button10"
        };

        private static readonly string[] m_joystickButton11Map = new string[]
        {
            "Joystick1Button11",
            "Joystick2Button11",
            "Joystick3Button11",
            "Joystick4Button11"
        };

        ...old code...

        public static bool GetButton(XboxControllerInput.Button button, int userIndex = -1)
        {
            ...old code...

            if (xboxController.IsConnected)
            {
                ...old code...
            }
            else
            {
                switch (button)
                {

                ...old code...

                case XboxControllerInput.Button.LeftTrigger:
                    return MoonInput.GetButton(XboxControllerInput.m_joystickButton10Map[num2]);
                case XboxControllerInput.Button.RightTrigger:
                    return MoonInput.GetButton(XboxControllerInput.m_joystickButton11Map[num2]);

                ...old code...

                }
            }
            return false;
        }

        ...old code...
    }
}

The script doesn't work, i get this warning : "Can't load Mono.Cecil.Reflexil.dll, press any key to exit..."

The script file doesn't work... i get this warning : "Can't load Mono.Cecil.Reflexil.dll, press any key to exit..."

I run Ori in Steam and under Windows 10. Tried to map my logitech dual action pad with Pinacle and the gamepad configuration doesn't even change inside the game. Tried to click-shift on the executable file and change every button as it is told in Steam discussion... won't help either.

Is it just possible to get a Dual Action pad from Logitech to work with this game?

Thx for your help!

missing dll?

Powershell says: WARNING: Can't find Assembly-CSharp.dll in

I'm not familiar with what this file does, or where it should be located. How can I fix this?

Warning : Can't find referenced assemblies

I did paste the 4 files from
D:\Steam\steamapps\common\Ori DE\oriDE_Data\Managed
to the folder where your .cmd script was, and when i run the script it shows 2 warnings and after replacing the Assembly-CSharp.dll the bind wont work ingame.

                    ___                                   ______                   ________)
                  /(,  )    ,           /)     /)        (, /    ) /) ,      /)   (, /
                 /    / __      _ __  _(/   _/(/   _       /---(  //   __  _(/      /___, ____  _ _  _/_
                /    / / (_(_  (_(/ ((_(_   (_/ )_(/_   ) / ____)(/__(_/ ((_(_   ) /     (_) (_(//_)_(__
               (___ /                                  (_/ (                    (_/

                           __
                          /    _   _  |_  _  _  | |  _  _    _  _  _   _   _    |_  _   _  |
                          \__ (_) | ) |_ |  (_) | | (- |    |  (- ||| (_| |_)   |_ (_) (_) |
                                                                          |
________________________________________________________________________________________________________________________

Available controller mappings:

Number Name                            A B X Y LTrigger RTrigger LShoulder RShoulder LStick RStick Select Start
------ ----                            - - - - -------- -------- --------- --------- ------ ------ ------ -----
     0 Cyborg Rumble Pad               2 3 1 4 7        8        5         6         11     12     9      10
     1 Enter                           3 2 4 1 7        8        5         6         11     12     9      10
     2 Knup KP-3121 USB Joystick       3 2 4 1 7        8        5         6         11     12     9      10
     3 Logitech Dual Action            2 3 1 4 7        8        5         6         11     12     9      10
     4 Logitech Rumble Pad 2 USB       2 3 1 4 7        8        5         6         11     12     9      10
     5 Nintendo Classic Controller Pro 2 1 3 4 7        8        5         6         12     11     9      10
     6 PS To PC Converter              3 2 4 1 5        6        7         8         11     12     9      10
     7 TigerGame PS/PS2 w/ SuperJoyBox 3 2 4 1 7        8        5         6         11     12     10     9
     8 Twin USB Joystick               3 2 4 1 5        6        7         8         11     12     9      10



Select configuration number: 1
Active configuration:

Number Name  A B X Y LTrigger RTrigger LShoulder RShoulder LStick RStick Select Start
------ ----  - - - - -------- -------- --------- --------- ------ ------ ------ -----
     1 Enter 3 2 4 1 7        8        5         6         11     12     9      10


Press any key to continue...
Searching for 'Assembly-CSharp.dll'
Searching for referenced assemblies: mscorlib.dll, System.dll, UnityEngine.dll
WARNING: Can't find referenced assemblies:
WARNING: C:\Users\farooq_fox\Desktop\Ori-Controller-Remap-master\Ori-Controller-Remap-master\UnityEngine.dll
Press any key to exit...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.