xan1242 / NFS-XtendedInput

NFS (Black Box, MW & newer) - XInput Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TODO] Rumble support in the near future

HarGabt opened this issue · comments

Looking through your TODOs, you are planning to bring rumble function into your mod.
I just have a question:
Are you going to implement it using the existing behaviour in the PC version or you are going to do it relying on the behaviour as seen on consoles (like Xbox 360)? Because those implementations do differ, and on PC rumble feature was made with steering wheel in mind, thus having poor implementation.

commented

Just in case you guys weren't already aware: you can get rumble working with XInput Plus when enabling DirectInput output, but the game's implementation seems spotty. It's not uncommon for it to bug out and stop working entirely. And when it does work, some of the effects are missing or aren't as good as console.

Is there any progress on this? Rumble adds quite a lot to gameplay experience, having it on the PC version would be great.

Nothing yet, sorry. I've been focusing mostly on porting the current functionality across all games (and polishing what's there). I believe I've mostly fulfilled that goal (except for World) and that this is the next thing to focus on anyway.

When you see commits related to rumble, you'll know then that I started working on it. As of now I have some other projects to do and I feel like this has reached the point of being good enough that it can stay like this for a little while before I come back to it.

OK so in order to implement this, we need the IFeedback class figured out and added to the existing InputDevice class.

Since I've targeted the InputDevice class instead of GameDevice class, it's a little more barebones than what the game normally uses.

From what I can tell, the game just tacks on an IFeedback class (at 0x2C) right after fControllerCurve (which is at 0x28). The referenced UTL (or UCOM) list is the one I initialize as a dummy at Padding1 (which will need proper renaming and implementation).

(Using NFSMW as a reference here)

image

Furthermore, the vtable containing functions for GameDevice::IFeedback is mostly empty on the PC version...

image

...while on the consoles it's fully implemented (PS2 MW below)

image

So basically it seems that these effects will have to get totally remade/ported from these builds. It's mostly some floating-point maths anyways and getting the numbers out of the 360 builds seems easy enough. (360 ProStreet below)

image

Right now, LocalPlayer::DoFFB() is completely skipped because the FFB pointer is nulled out on it (because it's not initialized). Initializing it here should do the trick in theory, but only testing will show results.

Once that function is in action, it should start working. (Not to mention that we need to add a vibration timer for the controller state update, but that seems easy enough to implement)

Also it seems that GameDevice also has some other values inside (such as GameDevice::mNOSEngaged) which we may or may not need...

There's one feature I would like to request for this in the future, with the old buggy vibration driver that converts dinput to xinput the vibration stops working if you use a wireless xbox series S controller with the dongle. I think it's because the device name doesn't show up as Controller if you're using it wirelessly but rather Xinput Compatible Device. Really hope this works with all xbox controllers, Thanks again for looking into this <3

Yeah the rumble will not depend on old DInput in any way... This is purely focused on XInput for controllers and Win32 for KB+mouse.

The goal is to reimplement it as closely to the console versions as possible.

Maybe someday it'll be possible to get proper DInput for wheels working too with proper FFB feel (depending on road surfaces and all that fun stuff) and everything related to that in the future, but that's outside my scope right now.

Right now, just getting the console experience on PC and nothing else.

(offtopic - hi MarioTainaka! it's been a while since sonic generations hasn't it? hehehe)

Yeah the rumble will not depend on old DInput in any way... This is purely focused on XInput for controllers and Win32 for KB+mouse.

The goal is to reimplement it as closely to the console versions as possible.

Maybe someday it'll be possible to get proper DInput for wheels working too with proper FFB feel (depending on road surfaces and all that fun stuff) and everything related to that in the future, but that's outside my scope right now.

Right now, just getting the console experience on PC and nothing else.

(offtopic - hi MarioTainaka! it's been a while since sonic generations hasn't it? hehehe)

Just getting this working with Xinput controllers for all the black box titles would be a huge help! It's frustrating having to use so many mods to get the controller working

yup Generations modding is still kicking, can't wait for you to se what everyone's come up with when SHC kick off.

Monitoring the PS2's effect_states array (NOS specifically)... it seems to match the 360 values I showed previously perfectly... (values are greater than 0 if NOS is on)

cheatengine-x86_64-SSE4-AVX2_XYLlmN7RXo

Also of note - these values do NOT get updated if vibration is turned off in the controller settings!

a good start would be sending those values to xinput's rumble functions

xbox 360 versions probably would be of more help there

FYI - I've created a new branch rumble-test.

As of now I've only stubbed out IFeedback and nothing more. It's crashing during LocalPlayer::DoFFB() after it calls IFeedback::UpdateTireSkids for whatever reason.

https://github.com/xan1242/NFS-XtendedInput/tree/rumble-test

In any case, this is still in the early stages.

FYI - I've created a new branch rumble-test.

As of now I've only stubbed out IFeedback and nothing more. It's crashing during LocalPlayer::DoFFB() after it calls IFeedback::UpdateTireSkids for whatever reason.

https://github.com/xan1242/NFS-XtendedInput/tree/rumble-test

In any case, this is still in the early stages.

hi is there any progress?

FYI - I've created a new branch rumble-test.
As of now I've only stubbed out IFeedback and nothing more. It's crashing during LocalPlayer::DoFFB() after it calls IFeedback::UpdateTireSkids for whatever reason.
https://github.com/xan1242/NFS-XtendedInput/tree/rumble-test
In any case, this is still in the early stages.

hi is there any progress?

Unfortunately no. You can always check the commits for rumble/vibration related changes.