Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Rewired - Advanced Input for Unity

Discussion in 'Assets and Asset Store' started by guavaman, Sep 25, 2014.

  1. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi,
    I'm facing a new issue after updaing to Unity 2022.3.22 and rewired 1.1.54.1 regarding the "Last Active Controller" in editor Play mode (everything works as expected in the Build).

    Before updating, when i enter play mode (using the mouse), the "Last Active Controller" was set to Mouse, when i move the joystick of my Xbox controller (yes correctly connected and detected by rewired), the "Last Active Controller" will be set to that controller. and vis-versa. I use this behaviour to switch the game control/and UI glyph between Keybaord/mouse and any other joystick.

    After upgrading, only keyboard or mouse are detected by rewired as the "Last Active Controller". Pressing any button on the Xbox controller (wired or via bluetooth) has no effect in Editor/Play mode and the "Last Active Controller" stays on Mouse . Rewired do detect the xbox controller and i do have a an active mapping for it.

    I'm suspecting this to be a bug. Many thanks for your help


     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    I cannot reproduce any issue and there is nothing that has changed in Rewired that would cause controller input to behave differently than keyboard input or mouse. The only recent change was the addition of polling Application.isFocused on start in order to get the application focused state on start. This doesn't even affect the editor because the code specifies that the editor will always be considered focused on start (as it was before), therefore this value is not even polled in the editor. Further, the exact same function is called to determine if input is allowed based on the application focus state for keyboard, mouse, and controllers. Therefore, this change cannot have affected controllers but not keyboard and mouse.

    Something else is happening and I don't have enough information to tell you what it is at this point.

    1. Open Debug Information -> Controllers -> Joystick -> XInput Gamepad 1 -> Axes, click back into the Game window, and start moving the sticks around. If the axes are returning any non-zero value when you move the sticks, there is nothing wrong and input is being read and processed for the device.

    2. Open Debug Information -> Player -> Player0 -> Actions -> Some action that is bound to something on the Xbox controller, click back into the Game window, and activate elements and watch the Action values in the Player. If the Action values do not return anything, go through this checklist until you find at which point input is failing.
     
  3. NPTP

    NPTP

    Joined:
    Apr 3, 2024
    Posts:
    2
    Hi, I'm on Unity 2021.3.7f1 and using Rewired 1.1.44.0.

    I'm having an issue where I manually change controller maps and gamepad stops responding. Keyboard and mouse still work and trigger the actions in the new map category, but gamepad doesn't seem to react. Changing back to the default map category, both keyboard and gamepad respond as expected. I have checked to ensure the player still has the gamepad in its controllers after changing maps, and it does. I have looked through everything in the Rewired input manager settings and the way I have the maps set up for Joystick, and am coming up blank on why the gamepad just... doesn't work on this controller map. Let me know if you have any ideas, thanks!
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    The only possible way to debug a problem like this is to use Debug Information to analyze what is happening at runtime. Looking at things in the Rewired Input Manager will not tell you anything about what's happening at runtime, especially if you are saving and loading user data.

    Go through this checklist:
    https://guavaman.com/projects/rewir...l#debug-information-diagnosing-input-problems
     
  5. NPTP

    NPTP

    Joined:
    Apr 3, 2024
    Posts:
    2
    Thank you! Step 4 under "Joystick control doesn't work" saved me. I hadn't assigned the additional/problematic joystick map to the players. I misunderstood thinking they would be auto assigned, contained in the joystick itself and independent of the player. Much appreciated!
     
  6. contactadrivilla

    contactadrivilla

    Joined:
    Feb 21, 2024
    Posts:
    1
    Hi,
    I'm using Unity 2022.3.20f1 and Rewired 1.1.54.1.
    I'm trying to have a button that resets controller maps back to default bindings.
    To do so, I cal this method
    Code (CSharp):
    1.  public void ResetSettings()
    2. {
    3.      //Check if we are in the controller menu or the keyboard menu
    4.      if (_bootOutifNoControllerFound)
    5.          player.controllers.maps.LoadDefaultMaps(ControllerType.Joystick);
    6.      else
    7.         player.controllers.maps.LoadDefaultMaps(ControllerType.Keyboard);
    8. }
    The issue is that after doing this, using something like this
    Code (CSharp):
    1.  player.controllers.maps.SetMapsEnabled(false, RewiredConsts.Category.Pause);
    throws an error, saying that a Controller Map cannot be null. I tried setting player to ReInput.Players.GetPlayer(0); again but it still returns null.

    Is this intended? Am I missing something? I looked at the Control Mapper script to look how to restore defaults and saw the LoadDefaultMaps()
    method so that's why I tried this. If there is another way to restore default bindings or need more information let me know.
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Please post the error and any stack trace it prints. I see nothing in any code related to these functions that would print an error saying a Controller Map cannot be null.

    There is one place in the codebase that can print "The Controller Map cannot be null." and that is in Input Mapper, which is not related to anything you have posted here. If that error is being thrown, you are trying to pass a null object in InputMapper.Context.controllerMap to the InputMapper.Start function.
     
  8. Mechano_

    Mechano_

    Joined:
    Dec 7, 2019
    Posts:
    3
    Sure,
    upload_2024-4-8_14-23-32.png

    Here's the code
    Code (CSharp):
    1. public void BindInput(int action, ControllerMap controllerMap)
    2.     {
    3.         //Do stuff here
    4.         player.controllers.maps.SetMapsEnabled(false, RewiredConsts.Category.Pause);
    5.         InputMapper.Context context = new()
    6.         {
    7.             actionId = action, // the id of the Action being mapped
    8.             controllerMap = controllerMap, // the Controller Map which will have the new mapping added
    9.             actionRange = AxisRange.Full, // the range of the Action being mapped
    10.         };
    11.         InputMapper.Default.options.timeout = _timeOut;
    12.         InputMapper.Default.options.allowAxes = false;
    13.         InputMapper.Default.options.allowButtons = true;
    14.         InputMapper.Default.options.checkForConflictsWithAllPlayers = true;
    15.  
    16.         InputMapper.Default.InputMappedEvent += OnInputMapped;
    17.         InputMapper.Default.TimedOutEvent += OnTimeoutMapping;
    18.         InputMapper.Default.options.isElementAllowedCallback += OnIsElementAllowed;
    19.         InputMapper.Default.ConflictFoundEvent += OnConflictFound;
    20.         InputMapper.Default.Start(context);
    21.     }
    Code (CSharp):
    1. [ActionIdProperty(typeof(RewiredConsts.Action))][SerializeField] int _action;
    2.     [ActionIdProperty(typeof(RewiredConsts.Category))][SerializeField] int _category;
    3.     [SerializeField] SettingsRebinder _rebinder;
    4.     public void StartRebind()
    5.     {
    6.         _rebinder.BindInput(_action, _rebinder.Player.controllers.maps.GetMap(_category));
    7.     }
    Also, when I click the reset button during gameplay, this automatically shows up
    NullReferenceException: Object reference not set to an instance of an object
    PartyManager.Aim () (at Assets/Scripts/Statics/PartyManager.cs:120)
    Which is:
    Code (CSharp):
    1. if (!playerInput.controllers.maps.GetMap(0).enabled) return;
    So it looks like controller maps are not reassigned automatically after calling
    Code (CSharp):
    1. public void ResetSettings()
    2.     {
    3.         //Reset bindings to default values
    4.         if (_bootOutifNoControllerFound)
    5.             player.controllers.maps.LoadDefaultMaps(ControllerType.Joystick);
    6.         else
    7.             player.controllers.maps.LoadDefaultMaps(ControllerType.Keyboard);
    8.     }
     
  9. Adam_Benko

    Adam_Benko

    Joined:
    Jun 16, 2018
    Posts:
    105
    Hi. I have infantry with WSAD keymaps and vehicle with the different actions using the same keyboard maps WSAD. The infantry can move but the vehicle does not react to the input using the same keyboard map. How can I set the same keybind in maps for different actions ?
    Thanks.
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    You're using mapId as an index in GetMap(int mapId). mapId is not an index. It is a unique id generated when the Controller Map is created. This id will not be the same after you call LoadDefaultMaps:

    https://guavaman.com/projects/rewired/docs/BasicUsage.html

    "Id" is NOT an "Index"

    Anywhere the term Id is used in the API is a UNIQUE ID, not an Index, and cannot be used to iterate over items or get the first Joystick.

    ---

    There are many other functions in Player.ControllerHelper.MapHelper which can be used to select or iterate through Controller Maps.

    LoadDefaultMaps will only load the Controller Maps into the Player that you have designated to be loaded in the Player on Start in Rewired Input Manager -> Players for that Player. If you have changed which Controller Maps are loaded in the Player through code, it will not keep those maps loaded, but will revert to the defaults.

    So it would seem to me that there is no Controller Map in the Map Category you are using for that controller type set to be loaded in the Player on start in your Rewired Input Manager -> Player settings.

    From the API docs:

     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    You can have as many bindings as you want on as many maps as you want to any Actions and they will all work, provided all the following are true:
    1. The Controller is not disabled.
    2. The Controller is assigned to the Player.
    3. One or more Controller Maps for that Controller are loaded in the Player, enabled, and have bindings of controller elements to Actions.
    Use Debug Information to figure out what is happening at runtime.
     
  12. Adam_Benko

    Adam_Benko

    Joined:
    Jun 16, 2018
    Posts:
    105
    Thanks. It didnt work because I didnt reset the controller to the default values in-game.
     
  13. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,060
    @guavaman Hi, I've sent you a Xbox GameCore request this week end. I just wanted to make sure that you guys received it and that the application looked ok. I'm not inquiring about the process as you already mentioned that it's out of your hands as for the time it takes etc ( I know the Xbox live team can sometimes take a little while to get back to us as well). I know I mentioned multiple emails in there as it was a pain to have all set up with them... SO i mentioned all the emails I had to use to have my account all set up.

    Thanks for letting me know if all was in good / decent form.

    All the best,
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    It looks fine to me. They will not accept an onmicrosoft.com email address. The others are under the same domain, so either will work.
     
    PROTOFACTOR_Inc likes this.
  16. Mechano_

    Mechano_

    Joined:
    Dec 7, 2019
    Posts:
    3
    Thanks, I was able to solve that,

    One more thing, when I try to set a callback response, I get this message:
    I am subscribed to ConflictFoundEvent and I have set options as check for conflicts as true but no dice, where can I set the map listener to wait for a response?
    This is the method that fires this Warning
    Code (CSharp):
    1. private void OnConflictFound(InputMapper.ConflictFoundEventData data)
    2.     {
    3.         conflictData = data; // store the event data for use in user response
    4.         for (int i = 0; i < conflictData.conflicts.Count; i++)
    5.             print(conflictData.conflicts[i].elementDisplayName + " is already in use in " + conflictData.conflicts[i].action.descriptiveName);
    6.         if (conflictData.isProtected)
    7.         {
    8.             conflictData.responseCallback(InputMapper.ConflictResponse.Cancel); // cancel polling
    9.         }
    10.         else
    11.         {
    12.             conflictData.responseCallback(InputMapper.ConflictResponse.Replace);
    13.         }
    14.     }
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    There is no code path that would lead to this result with the code you have shown unless you are subscribed to ConflictFoundEvent multiple times and therefore this code is being called multiple times. The first time you invoke conflictData.responseCallback, the conflict is resolved and the input mapper state changes from AwaitingResponse and calling this function again will result in the error message you are seeing.

    It automatically goes into the AwaitingResponse state immediately before this event is fired.
     
  18. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Hi - how can I detect press of Touchpad on Sony DualSense? I don't mean the multi-touch support like you show in the DS4 special features demo project, which is working perfectly.. I mean when the touchpad is pressed in as a button. I looked at the docs and extension API and also tried some random things, but even GetAnyButtonDown doesn't respond to it. Do you have any solution/suggestion/workaround? Sorry if I missed an example of this somewhere. Thanks.
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Make a map for the specific controller and don't just rely on the Gamepad Template. The Gamepad Template does not cover all possible elements on all devices with which it is compatible.

    https://guavaman.com/projects/rewired/docs/ControllerTemplates.html

    "If you have created a map for a Controller Template but still want to make a map for a specific controller that is covered by the Controller Template, just create the map for the specific controller and it will override the map defined in the Template."
     
  20. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    Ah perfect, I see it now, and yes that's what I did wrong (because the project is currently PS5 exclusive, i had just modified the gamepad template and scrapped the other ones). But I see if I create a new map for DualSense it's perfect,
    dualsense.png

    Thanks! You're boss level as usual, and the quick response was greatly appreciated :)
     
  21. guidaye

    guidaye

    Joined:
    May 20, 2022
    Posts:
    19
    Hi guavaman,
    We have upgrade rewired from 1.1.45.0 to 1.1.54.1 recently for our project, but the problem remains, since our project is kind of complicated, we will try to craeta a new project with rewired to reproduce the issue, and attach the project as we reproduce it.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Then the only possible way that could be happening is if Application.isFocused is returning the wrong value and I will not be able to fix it.
     
  23. guidaye

    guidaye

    Joined:
    May 20, 2022
    Posts:
    19
    We test it again, and it works, I am not sure why, but it did happen for the last test. any way, thanks a lot. we will keep eyes on this and see if it still happens in certain conditions.
     
  24. Andrew-Carvalho

    Andrew-Carvalho

    Joined:
    Apr 22, 2013
    Posts:
    45
    Hey, just following up on the advice given on loading a map without a controller connected. You (and the documentation) mention element IDs may be different using this method. You also mentioned in the reply that for fixed platforms like consoles, it should be consistent.

    I'm noticing that if a controller is disconnected, incorrect buttons (but for the correct controller) are being pulled, when running on actual hardware. Is there something that could be causing this? In this specific instance, I am noticing the issue on PS5.
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    The documentation states element indices will not be reliable. Element Identifier Ids are constant across all platforms. Element Identifier is a higher level construct that represents a known fixed, platform-agnostic representation of a controller element on a device, and is defined in the Rewired controller definition (Left Stick X, etc.). Element index is the actual button or axis index exposed by the current input API in use on the specific platform and input source. Every platform and input source may expose elements of the hardware differently (button may be axis, vice versa, element counts may differ, etc.) and a in a different order. Element index is mapped to an Element Identifier Id for each input source in the controller definition in order to standardize elements across platforms and input sources. Element index is exposed in Action Element Map (cached here for value lookup efficiency), but Action bindings are made to Element Identifier Id, not element index. (When you create Controller Maps in the Rewired Input Manager, element indices cannot be known yet because the platform and input source are not known yet.)

    I can see no way this could return the wrong result, for Element Identifier Id or even for element index, on PS5 or any console platform where the element indices are known and fixed for a device. There is only one possible input source and one controller definition for a device on console platforms and these values cannot change. The only way I can imagine returned Element Identifier Id values being wrong is if you are expecting to get user-remapped values and are using the wrong function that does not retrieve bindings from saved user data.

    https://guavaman.com/projects/rewired/docs/HowTos.html#get-mappings-for-joystick-not-attached

    Joystick Maps:
    ReInput.mapping.GetJoystickMapInstance

    If you need to display gylphs for saved user mappings:
    ReInput.mapping.GetJoystickMapInstanceSavedOrDefault
     
    Last edited: Apr 19, 2024
  26. Jamez0r

    Jamez0r

    Joined:
    Jul 29, 2019
    Posts:
    206
    Hey guavaman, found this thread while researching/implementing the Control Mapper and saw that you're still actively responding to questions here.

    Just wanted to say that Rewired is a godsend. We've been using it in our project since the beginning (4 years ago), but we just decided that we needed to implement button remapping and I was pretty worried about how long it was going to take, and kept putting it off. Using the Control Mapper prefab I was able to set it up, integrate it with our pre-existing Rewired configuration, customize its layout/visuals to fit our style, and up Localization for all of the text for it in 2 days. I was expecting it take around a week of head-scratching, but your documentation for the Control Mapper and with the way you have the pieces of it set up (prefabs that can be configured and customized, and are then generated at runtime to create the actual menu, etc), I can tell you put a lot of work into that to make it "just work" as much as possible but also be flexible for all sorts of platforms/layouts. etc. Thanks for that!
     
    guavaman and flashframe like this.
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Thanks! I'm glad you like it.
     
  28. Renegade_Wolf

    Renegade_Wolf

    Joined:
    Jan 17, 2022
    Posts:
    49
    I, too, just implemented Control Remapping after several days of struggling to get something working with the new Input System, only to discover Rewired and how it really just works. Excellent work on this and I have loved it since the moment I got it.
    I'm trying to do a very minor extension/external control on the Control Mapper. I would like to display actions/action maps to the player as the player unlocks the ability to use those actions (so as to not ruin them ahead of time). Any thoughts or suggestions on how to go about this? It looks to me like I might need to add a call at the beginning of the Initialization() which would update the _mappingSets array, although I'm not seeing where this array is updated with what's in the Control Remapping Inspector and as it's a private variable with no setter that I can see, I'm wondering if I might be going about this the wrong way.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Control Mapper is not designed for such a special case use case and modifying the source code is not supported. I suggest you make your own remapping system using Input Mapper.
     
  30. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    Hi, I updated Rewired to use the latest version in a project in 2019.2.3.f1. I have some errors in console, crashing for have two Rewired_DirectInput and Rewired_WindowsGamingInput (one in x64 folder and another in x86).

    The quick solution was remove the files from x86 folder, it's fine? 32 bit users will have any struggle?

    Or there is a better solution?

    Thanks in advance!
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    These DLLs already come with the correct settings when imported. I wouldn't have been able to publish it without receiving these same errors if they didn't.

    Reinstall it and make sure every single file is checked in the Unity asset importer dialog.

    Make sure you are not installing the wrong version of Rewired (Unity 2020 or something) in Unity 2019:
    Window -> Rewired -> Help -> About

    If all else fails, delete Rewired and reinstall:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#clean-reinstall
     
  32. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    I checked and the installed version was 1.1.49.2.u2020. I followed the steps and now I have running properly the version 1.1.45.0.u2018. Thank you for your quick support!
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    You said you are using Unity 2019.2.3f1. You must use Rewired for Unity 2019. Using a version of Rewired not built for the version of Unity you are using is an error and could result in all manner of problems.

    Rewired for Unity 2019 is the earliest version of Rewired available for download on the Unity Asset Store. Anything older has not been updated in over a year due to Unity Asset Store policies preventing upload for older versions of Unity.

    Further, Rewired 1.1.45.0 is very old. Download the current version from the Unity Asset Store for Unity 2019.

    Dealing with Unity Asset Store downloading the wrong version:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#wrong-rewired-version-installed
     
    Last edited: Apr 24, 2024
  34. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    I don't know, I tried again and this one is the version that I get after clean the cache folder and download the asset from Asset Store. There is a way to specify which version I want to download?

    I want to avoid a clean installation because everything works fine and I have a lot of controllers configured with the Rewired Editor.
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    1. The Unity Asset Store downloads the asset for the version of Unity in which you open the asset store. There is no manual selection of which version to download. Delete all cache files and download it in the Asset Store in Unity 2019. The problem is, you are using Unity 2019.2. The Unity Asset Store only supports 2019.4 at earliest. This is Unity's policy. Therefore, the only way you will be able to download Rewired 2019 is manually on my website. Send a message on the support form and I will give you access. However, Rewired for Unity 2019 is only built for Unity 2019.4.0+ because of Unity's policy, so older versions for Unity 2019.2 are no longer available. It may or may not have issues in Unity 2019.2 depending on if Unity modified any data formats between 2019.2 and 2019.4. Is there some reason you are not using the last LTS version of Unity 2019?

    2. The Rewired folder does not contain your user data. Read the documentation to understand how data is stored:
    https://guavaman.com/projects/rewired/docs/InputManager.html
    https://guavaman.com/projects/rewired/docs/FAQ.html#where-is-data-saved
     
  36. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    This is an old and really huge project started 8 years ago, so, is not an easy migration. I want to update to 2020 but after publishing the game (in one month). At this point it would be easy to update Rewired also. Thanks again for your answer, sorry for so many troubles.
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Then your best option would be to download Rewired for Unity 2019.4 from my website and see it there are any issues. The only issues that might occur would be with file formats if Unity changed anything in the meta files or data file formats between 2019.2 and 2019.4, but I doubt that is the case.
     
  38. JohnDraisey

    JohnDraisey

    Joined:
    Jul 28, 2013
    Posts:
    24
    Hey how's it going? I'm using Rewired 1.1.47.0.U2022 and have a vehicle Boost action that works well with the Gamepad (takes 5 seconds to overload). But with my Shift Key for Boost it overloads in 1 second. Do keyboard keys give more input strength than gamepad buttons?
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Buttons and keys are 100% identical. I don't know what you mean by "Boost overloads in X seconds" because I don't know how you have chosen to read input for this Boost action or when/how it overloads.

    Keyboard keys and buttons are binary True / False values. If you consume input with player.GetButton, the value will always be True when the key/button is pressed and False when it is not. If you consume input with player.GetAxis, the value will be 1.0 when the key/button is pressed and 0.0 when it is not. If you have left the default Digital Axis Simulation enabled, the Action's axis value will change over time.

    See this:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#digital-axis-smoothing
     
  40. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    Yes, I can do that. I'll ask on the support soon
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Rewired 1.1.55.0 is available on the Unity Asset Store.

    Release notes:

    1.1.55.0:

    Changes:
    - Added Update Mode option.
    - Removed DualSense Edge Enhanced Device Support due to not functioning correctly.

    API Changes:
    - Added Rewired.ReInput.Update function.
    - Added Rewired.ReInput.ConfigHelper.updateMode property.
    - Added Rewired.Config.UpdateMode enum.
    - Added Rewired.ControllerExtensions.DualShock4Extension.batteryCharging property.

    Bug Fixes:
    - Sony Dual Shock 4, Enhanced Device Support: Fixed incorrect battery level.
    - Sony Dual Sense, Enhanced Device Support: Fixed incorrect battery charging state and battery level.
     
    JohnDraisey likes this.
  42. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    382
    Hello Rewired Sensa, May I please get a link to a tutorial to set up UI Joystick, I forgot how to do it.

    Also I use playmaker ?

    Thank you.

    To be specific, I cant seem to get the axis vector of the UI Joystick or get it to work with the character controller. I know you can and its easy, I did a lot in the past, but I forgot how to.
     
    Last edited: Apr 27, 2024
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    The documentation on Touch Joystick is here:
    https://guavaman.com/projects/rewired/docs/TouchControls.html#touch-controller
    https://guavaman.com/projects/rewired/docs/TouchControls.html#touch-joystick

    Touch Controls are designed to pipe input into a Custom Controller, which in the end, works exactly as joysticks, keyboard, or mouse. The Custom Controller must be assigned to the Player and a Controller Map must be loaded in the Player that applies to that Custom Controller, mapping controller elements to Actions. The input value is then retrieved in the normal way from the Player like for any other controller type.

    https://guavaman.com/projects/rewired/docs/HowTos.html#get-input
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#controller-doesnt-work
     
    XCO likes this.
  44. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    382
    Thank you very much for this, but my character is running around in circles and I JUST dont remember how to do this.

    May I ask SENSA for a small guide, or a step by step example, maybe I can figure out what I did wrong ?
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    No, sorry. I don't write custom tutorials on demand that repeat the same information that is in the documentation. The Rewired documentation is extremely thorough and shows everything needed to setup touch controls, and Debug Information provides all the information necessary to debug any issue.

    https://guavaman.com/projects/rewired/docs/TouchControls.html#custom-controller-setup
    https://guavaman.com/projects/rewired/docs/TouchControls.html#touch-controller-setup
    https://guavaman.com/projects/rewired/docs/TouchControls.html#touch-joystick
    https://guavaman.com/projects/rewired/docs/Examples.html#touch-joysticks-1
     
    Last edited: Apr 29, 2024
  46. facundogalella

    facundogalella

    Joined:
    Mar 5, 2016
    Posts:
    65
    Following this topic, I tried it, and it didn't work, recovering the problem of my first point. So, I migrated the project to 2021.3.15f1 (LTS) and I updated Rewired into the last version for 2021. I have no warning and I'm using the right version.

    Thanks for your support!
     
  47. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    307
    Hi,

    Is there a reason why the Steam Deck isn't officially supported?

    I was googling for this, and I came across a discussion in this same thread from a couple years back. The conclusion seemed to be that L4/5 and R4/5 can't be remapped because Rewired doesn't recognize them; it just sees the device as an Xbox controller.

    I asked Steam support if this would be a problem, and they were a little vague about it, but they implied that the game might be classified as "Playable" rather than "Verified", i.e. it would have the yellow warning mark.

    Now that the Steam Deck is released + widely available, is there any way we can get full support for it and get access to those extra buttons? Or is there a technical reason why the device is different from a normal controller?
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Yes. Because I do not want to integrate the Steam API into Rewired for many technical reasons. I have explored it in the past very extensively. Trying to mesh the two different action-based input systems with different features is utter chaos. Last I looked, the Steam API does not expose devices with lists of buttons and axes. Rewired was designed around wrapping devices with lists of fixed controller elements, not wrapping another player-action system. You end up with two separate, incompatible Action lists, one in Rewired, one in Steam. Rewired can no longer manage mappings because Steam has to be in charge of Action mappings for Steam devices, so remapping UIs must be disabled for Steam devices only while potentially still supporting them for other devices that are not Steam-configured. Because Steam manages Actions and bindings through json files, I would be forced to create a whole new Steam action mapping editor system to synchronize Actions between Rewired and Steam as best as can be done. Rewired breaks devices down into 1D axes and buttons. Steam can map Actions to 2D sticks or even motion sensor values, which do not translate over to Rewired. Steam has its own glyph management system too. It's a huge square peg, round hole problem.

    Also, there are problems with initialization of Steam, which can be done in multiple incompatible ways because of how their API evolved over time. And then there is the maintenance burden of keeping up with Steam API updates and deprecations.

    Supporting the Steam API involves far more than adding support for another platform or device.
     
    Last edited: May 5, 2024
  49. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    307
    Thanks for the reply. Hmm, so that means the Steam Deck's input is actually handled by the Steam API and not like a regular piece of hardware?

    My understanding was that, normally, an OS can read most game-ish input devices as a game controller (e.g. XInput on Windows). So, if you plug in a DDR mat or a steering wheel, technically you can go into Device Manager on Windows and see how the different buttons map to a standard controller's buttons. And that's why (I think?) we're able to use those controllers in Rewired.

    If the Steam Deck works differently from this, then I can see your point, yeah. I was expecting that those extra triggers would be accessible in the OS just like the buttons on a DDR pad, like the Linux equivalent of Device Manager. If that's not the case, and if you need the Steam API to get access to those buttons, then I can understand why you wouldn't want to add it.
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,644
    Yes, just as the Steam Controller was.

    It's complicated. The only things that show up through XInput are explicitly XInput-compatible devices. If they weren't made for XInput with all the limitations it has (4 devices, fixed set of Xbox 360 gamepad elements), it will not even see them. Most controllers on Windows are supported through Raw Input (or Direct Input if you choose) in Rewired. This is basically a HID system which gives you access to all the standard HID stuff. Rewired ignores everything but certain HID device types including Gamepad, Joystick, and a couple of others. These HID devices provide a HID descriptor which provides information about each element (though not nearly enough information to identify that something is a gamepad, which elements are sticks, which are triggers etc. all of that information is provided in Rewired's controller definitions.) Input values for each controller element are returned in each HID input report.

    The Steam Controller doesn't conform to normal HID device standards. It's not possible, for example, to use the controller without Steam and its driver (I tried). And to make things more complicated, Steam intentionally hides the HID device from the application so its not seen as a controller that doesn't function. However, because of Steam's complicated API hooking system, they are able to expose virtual devices through the different Windows input APIs to the application. Steam creates a Raw Input, Direct Input, XInput, and Windows Gaming Input device for each controller and hides the real device from all those APIs (and the Windows HID API device list as well). Rewired filters out redundant devices across the different input APIs when using multiple APIs simultaneously. Linux EVDEV is something like Raw Input, but not quite as low-level (Steam Deck runs on Linux natively, but can run Windows applications through emulation.)

    The virtual device that Steam creates for each controller is based on the Xbox 360 controller. They even expose it to the application with the same identifying HID information as the Xbox 360 controller. That means it's limited to the number of elements on that controller. That is why the two extra triggers cannot be supported.

    Unless something has changed since the last time I looked, the Steam Controller and Steam Deck can only be fully supported through direct calls to the Steam API. The game must be set up to use Steam Input and Actions and bindings must be configured for the game in a json file included with the application in Steam. The Steam Input API does not provide buttons and axes, but instead Action values, similar to Rewired's Player-Action system, but their Actions support more dimensions and data formats than Rewired's. From what I recall, the only information you could get about the device elements was to query an Action for some information about the bound element(s) such as display name and glyph.

    Steam Input support requires that the user be able to rebind their controls to Actions in the Steam Interface. Steam Input provides a lot of similar functionality to Rewired for managing map categories, layouts, enabled states, etc. as well, and all of that has to be managed through the Steam API using their structures, functions, etc., and not Rewired's, so half of Rewired's usefulness goes out the window. And because of differences in how the systems work, it would likely be impossible to seamlessly wrap their system inside Rewired's current API.

    Because of the Steam-side mapping requirements, it would be completely impractical to attempt to support both devices exposed by the Steam API and devices exposed by the other native APIs Rewired supports (flight controllers, racing wheels, misc devices, etc.). That would require users to map devices in two different places, depending on if the device is Steam-configured or not. That would be silly. So that means, when using Steam Input, Rewired would basically have to become a front-end for the Steam Input API. and almost none of the Player-Action Controller Map system would apply (basically most everything in the Rewired editor) or any of the remapping stuff. I would have to come up with a totally new Steam Controller Map and Steam Device classes that conform to their system design and wraps their API, then wedge that into the Player somehow so at least the Player-based input consumption API could be the same. I explored all this in the past extensively and wrote tons of code (I still have it all) but quit when I got to the point where I realized I'd basically have to overhaul the entire system. I also explored the terrible idea of faking a device by creating Actions in Steam for each device element (Button X action) so that Rewired could just treat it like a controller. I don't think Steam or Players would be too happy opening their Steam remapping UI only to see a bunch of Actions named for buttons and sticks bound to the same elements and be expected to remap in-game instead.

    Adding support for Steam Input is vastly more complicated than adding support for a new device or even a new platform. Unless something has changed since I looked into this and they've exposed the device elements directly and no longer require that the user be able to manage remapping and maps on the Steam side, I won't be adding support for it.
     
    Last edited: May 7, 2024
    _eternal likes this.