praydog / REFramework

Scripting platform, modding framework and VR support for all RE Engine games
https://cursey.github.io/reframework-book/
MIT License
2.91k stars 355 forks source link

Request: Enabling Simultaneaous Controller+Keyboard/Mouse Input (Mixed Input) across all RE Engine-based games #674

Open AL2009man opened 1 year ago

AL2009man commented 1 year ago

To explain a bit of context: Simultaneously Controller+Keyboard/Mouse, Mixed Input (or Hybrid Input for newer Ubisoft games) for short, is a Input Method that enables users to use the Gamepad and Keyboard/Mouse Inputs at the same time. Typically: this is used for something like Gyro Aiming (most Controllers like PlayStation and Nintendo Switch), Tracking Aiming (for Steam Controller or Steam Deck, in combination with Gyro or not), Gaming Keypads (Azeron, Razer), Analog Keyboard (Wooting Keyboard), physically using Gamepad and Mouse device, etc. You could say this is an Accessibility-related request.

for simplification's sake: I will be referring to "Mixed Input" going forward.

Normally, this method will/may introduce issues such as:

quick off-topic: It's rare to find a game that allows you to use Mixed Input without conflictions (or as an option in the case with CULTIC and Death Stranding via Button Prompt Icon settings), which is why Valve Corporations recommends to not tie KB/M Button prompt switch based on Mouse Movement when preparing for "Steam Deck support". This is one of the most common chief compatibility issues that faced Mixed Input supports. But if you'd like to learn more: I suggest reading this article by Flick Stick creator and current-gyro expert Jibb Smart on Mixed Input.

As of this writing: Here's the list of known RE Engine-based games to be confirmed (by yours truly) to allow Mixed Input:

basically: all RE Engine-based games after Monster Hunter RISE (aka starting in that engine branch) will support Mixed Input, aside of Button prompt flickering.

You may have noticed that RE4 Remake is the only Resident Evil game to allow that, but not...the rest of RE Engine-based Resident Evil games? Well, this is because it suffers from the most nefarious of issues from the list [highlighted on the bold text] where it outright prevents you from using both Inputs at the same time. You are restricted to only one Input Method.

until Resident Evil 4 Remake: Resident Evil games always never allowed you to use Mixed Input, but given the context of RE4 Remake allowing you to use Mixed Input: I wonder if there's a way to untick the "Input Switch Lock" within the config/hex/REFramework that allows players to fully remove that restriction?

this option could benefit those who like to use Mixed Input on various setups in all RE Engine-based games instead of a small few.

LAN021 commented 1 year ago

I would very much like this as well, and possibly an option for locking the prompts to either controller or KB/M, regardless of input type. This is available in Death Stranding, as noted, and is extremely useful. If it's possible to lock the prompts in the four games with support for mixed input, that would be great as well (especially MHR).

On PCGamingWiki, Resident Evil 3 and Village are marked as having support for mixed input. Is this incorrect or does it not work properly? It's called "Simultaneous controller+KB/M" there, in the Input box, under "Additional information".

WiFiAdapter commented 1 year ago

Second this, can't properly play RE8 because of the lack of mixed input.

AL2009man commented 1 year ago

On PCGamingWiki, Resident Evil 3 and Village are marked as having support for mixed input. Is this incorrect or does it not work properly? It's called "Simultaneous controller+KB/M" there, in the Input box, under "Additional information".

As noted in the OP: nearly all the Resident Evil games I've played thus far (including the demos) historically never support Mixed Input (prior to Resident Evil 4 Remake), both RE3 Remake and RE Village are a part of it. they got that information wrong, and you can confirm that if you download the demos (or own the game). I really get the feeling they only swap between two input methods but not simultaneously.

LAN021 commented 1 year ago

On PCGamingWiki, Resident Evil 3 and Village are marked as having support for mixed input. Is this incorrect or does it not work properly? It's called "Simultaneous controller+KB/M" there, in the Input box, under "Additional information".

As noted in the OP: nearly all the Resident Evil games I've played thus far historically never supports Mixed Input (prior to Resident Evil 4 Remake), both RE3 Remake and RE Village is apart of it. they got that information wrong, and you can confirm that if you download the demos (or own the game). I really get the feeling they only swap between two input methods but not simultaneously.

Ok, was just looking for confirmation of that. I don't own the games, but if it's possible to get these features somehow, including locked prompts, I have more reasons to get them in the future, especially Monster Hunter Rise, which I can't play at all because of the control scheme (I use mixed input for remapping).

WiFiAdapter commented 1 year ago

I got it working. Now I only need to make a really simple script. The only thing I changed was the following: app.HIDManager -> AutoGenerated Types -> 0x58: app.HIDInputMode.Value -> app.HIDInputMode.Value -> Reflection Properties -> s32: 0

LAN021 commented 1 year ago

I got it working. Now I only need to make a really simple script. The only thing I changed was the following: app.HIDManager -> AutoGenerated Types -> 0x58: app.HIDInputMode.Value -> app.HIDInputMode.Value -> Reflection Properties -> s32: 0

Great work. How do the prompts work after that, do they change based on input? Is it possible to lock them to one type?

AL2009man commented 1 year ago

I got it working. Now I only need to make a really simple script. The only thing I changed was the following: app.HIDManager -> AutoGenerated Types -> 0x58: app.HIDInputMode.Value -> app.HIDInputMode.Value -> Reflection Properties -> s32: 0

That's great! I wonder how we are going to approach this?

some of RE Engine-based games already allowed for Mixed Input (Resident Evil 4 Remake is a recent example) but the KB/M glyph switch is based on Mouse Movement. I assume a toggle will give users the ability to forcefully lock Controller or KB/M Glyphs instead of automatic (or change the KB/M prompt switch detection based on keybind/mouse press/click, as per Valve's recommendations).

the rest (like Resident Evil 7 the DX12 edition, Resident Evil 2/3 Remakes and Resident Evil Villages)? You're forced to pick one Input Method, so I wonder how these titles will fare with your script?

WiFiAdapter commented 1 year ago

The glyphs are locked to pc symbols which could be a little bit troubling on the steam deck. The problem right now is that it seems that changing reflection properties as I did is not a good way to implement stuff. I’d need to find a method or maybe the actual method that is called upon using the controller. I will make another comment should I find something out about it.

Edit: I managed to make a script that allows mixed input, but I wasn't able to change the glyphs and honestly I don't know where to look for the right variables or methods.

LAN021 commented 1 year ago

@WiFiAdapter It's still great progress if you have managed to enable mixed input with locked KB/M prompts. It would be worth adding it to REFramework like that and add locked controller prompts later if you find out how to implement it.

What happens when you use controller input? Is there no switching? That means the game probably prioritizes KB/M prompts in case of input registered at the same time. Some games prioritize controller prompts and some KB/M prompts. In this case, maybe the changes you've made disable controller prompts entirely.

Have you tried setting a controller input to be always on in Steam Input, for instance, and see how it works? Or just holding down a keyboard key and moving a stick or pressing a button on the controller? That usually reveals what the game prioritizes. Maybe you could try that without your script.

dglt1 commented 1 year ago

The glyphs are locked to pc symbols which could be a little bit troubling on the steam deck. The problem right now is that it seems that changing reflection properties as I did is not a good way to implement stuff. I’d need to find a method or maybe the actual method that is called upon using the controller. I will make another comment should I find something out about it.

Edit: I managed to make a script that allows mixed input, but I wasn't able to change the glyphs and honestly I don't know where to look for the right variables or methods.

hi, would you mind sharing the mixed input script you made?

Vaizarr commented 1 year ago

This is exactly what I'm trying to fix! You can add Chivalry2 to the list. I'm using an Azeron keypad and because it keeps rapidly switching between inputs (controller/kb/mouse) it causes rapid stuttering. I've spent hours trying to work around it. Can you share some information how you solved some of the issues? How did you change these settings you're talking about?

AL2009man commented 1 year ago

The glyphs are locked to pc symbols which could be a little bit troubling on the steam deck. The problem right now is that it seems that changing reflection properties as I did is not a good way to implement stuff. I’d need to find a method or maybe the actual method that is called upon using the controller. I will make another comment should I find something out about it. Edit: I managed to make a script that allows mixed input, but I wasn't able to change the glyphs and honestly I don't know where to look for the right variables or methods.

hi, would you mind sharing the mixed input script you made?

Yeah @WiFiAdapter , it's been 3 months since the last update. It might be a good time to share the incomplete code to everyone if you aren't interesting in continuing it. Someone else might look into it using your work as a basis.

This is exactly what I'm trying to fix! You can add Chivalry2 to the list. I'm using an Azeron keypad and because it keeps rapidly switching between inputs (controller/kb/mouse) it causes rapid stuttering. I've spent hours trying to work around it. Can you share some information how you solved some of the issues? How did you change these settings you're talking about?

Um...Chivalry 2 uses Unreal Engine 4 and not RE Engine. It's a bit redundant to post it here, but I suggest posting it to official game's forum sites.

...however: the vast majority of Unreal Engine 4-based games play nicely with both input methods aside of Button prompt flickering. It's rare to find a game that doesn't have a problem with button prompt flicker.

although: There are some games (like Fortnite) that intentionally went out of their way to prevent some players from using that specific setup (like your Azeron keypad), so I wouldn't be surprised if Chivalry 2 is one of the rare UE4 games that prevents it.

LAN021 commented 1 year ago

@AL2009man I don't know if you mentioned me because you thought I made the script, but it was actually @WiFiAdapter. I'm awaiting this as eagerly as you are, it would allow me to play MHR and the RE Engine Resident Evil games without any issues. If this can't be achieved, then maybe someone can find a way to remap controller inputs, at least swapping the bumpers/triggers as in RE7.

AL2009man commented 1 year ago

@AL2009man I don't know if you mentioned me because you thought I made the script, but it was actually @WiFiAdapter. I'm awaiting this as eagerly as you are, it would allow me to play MHR and the RE Engine Resident Evil games without any issues. If this can't be achieved, then maybe someone can find a way to remap controller inputs, at least swapping the bumpers/triggers as in RE7.

Ops, I accidentally pinged the wrong person. Sorry!

but still, I'm already expecting far more RE Engine-based games to support Mixed Input going forward. But I'm hoping if there's a way to backport the improved Mixed Input implementation gets backported over to older engine branches.

AL2009man commented 1 year ago

The glyphs are locked to pc symbols which could be a little bit troubling on the steam deck. The problem right now is that it seems that changing reflection properties as I did is not a good way to implement stuff. I’d need to find a method or maybe the actual method that is called upon using the controller. I will make another comment should I find something out about it.

Edit: I managed to make a script that allows mixed input, but I wasn't able to change the glyphs and honestly I don't know where to look for the right variables or methods.

Hey, quick update: so apparently...since the Sunbreak update (or when they implemented RawMouse-- i dunno the timeframe): Monster Hunter RISE no longer cause button prompt to flicker based on Mouse Movement, It now only switches to Keyboard/Mouse prompts when you press a Keyboard/Mouse key. Aside of Camera conflict between XInput Right Stick Camera and Mouse Input : This will make Mixed Input far easier to use on a Steam Deck.

If you already having problems looking into the right variables/methods on locking the button prompts since you last worked on the script: I might suggest looking at how Monster Hunter RISE (since Sunbreak update) on how they handle button prompt flickering as a point of reference.

(Even if you don't have Monster Hunter RISE: you can download the demo, as it's also been updated to the Sunbreak expansion)

LAN021 commented 11 months ago

I was really anticipating this but @WiFiAdapter seems to be inactive, so I'm wondering if there is anyone that can continue this, as @AL2009man suggested in the post before.

I got it working. Now I only need to make a really simple script. The only thing I changed was the following: app.HIDManager -> AutoGenerated Types -> 0x58: app.HIDInputMode.Value -> app.HIDInputMode.Value -> Reflection Properties -> s32: 0

Can anyone work with this?

juliohintze commented 7 months ago

Edit: The script works only for RE8 for now.

Based on @WiFiAdapter's solution, I made a script that works.

Be aware: I know next to nothing about Lua and REFramework. WifiAdapter himself said that changing Reflection properties like this isn't the best idea. I don't know why that is, but I believe him. This script might screw other things over, and I'd probably have no idea how to fix it.

But for those who are interested:

local game_name = reframework:get_game_name()
local is_re8 = game_name == "re8"

if not is_re8 then
  error("Unsupported game: " .. game_name)
end

local function onUpdate()
  hid_manager = sdk.get_managed_singleton(sdk.game_namespace("HIDManager"))
  inputMode = hid_manager:call("get_inputMode")

  if inputMode.V == 1 then
    inputMode.V = 0
  end
end

sdk.hook(
  sdk.find_type_definition(
    sdk.game_namespace("HIDManager")
  ):get_method("doUpdate"),
  nil,
  onUpdate
)

Just drop a MixedInputs.lua inside the autorun folder and you're golden. If anyone have an idea how to fix the glyphs, it would be nice to share.

LAN021 commented 7 months ago

That's outstanding, thank you for your work. How do the prompts work after this? Do they auto-switch based on input or is it just KB/M? Is one or the other prioritized?

juliohintze commented 7 months ago

It's exactly as WifiAdapter said. It does let you use mixed inputs, but the side effect is that the prompts are locked to KB/M. I'll try looking into that later, but I don't even know where to start.

Having no experience with REFramework (or modding at all) made this task a LOT harder. If it wasn't for @WiFiAdapter's tip, I wouldn't be able to do it.

Also: I tried playing RE8 with gyro aiming yesterday, and the game has this auto-aim that REALLY makes things weird. I don't think the game lets you turn that off. That's another thing to look into.

LAN021 commented 7 months ago

Yeah, this is still outstanding, even if you're not experienced with this particular thing.

As I said previously:

It's still great progress if you have managed to enable mixed input with locked KB/M prompts. It would be worth adding it to REFramework like that and add locked controller prompts later if you find out how to implement it.

Do you think you can make it work in other RE Engine games as well?

juliohintze commented 7 months ago

I put an if statement to make sure that the script will only run in RE8. I can change that later, but I don't know if it'll work for other RE Engine games.

I can test it for RE2 and RE3, though. I don't think it would be that hard, but you never know.

LAN021 commented 7 months ago

Would be much appreciated, and just let us know if you make any other progress, such as finding a way to change prompts to controller. Maybe there's even a way to force PlayStation prompts in games that have them built in so you don't need to use texture mods.

AL2009man commented 7 months ago

I put an if statement to make sure that the script will only run in RE8. I can change that later, but I don't know if it'll work for other RE Engine games.

I can test it for RE2 and RE3, though. I don't think it would be that hard, but you never know.

I can confirm that the script does work on Resident Evil Village.

But doesn't work on Resident Evil 2 Remake, even if I replaced is_re8 = game_name == "re8" to is_re2 = game_name == "re2"

Screenshot 2024-04-05 141722

juliohintze commented 7 months ago

Yeah, I just looked into it. I have no idea how to make a script like this for other games, or even how to fix the prompts for RE8. Maybe it could be done using Cheat Engine, tho.