Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] Rumble support in the near future #10

Open
HarGabt opened this issue Apr 29, 2022 · 14 comments
Open

[TODO] Rumble support in the near future #10

HarGabt opened this issue Apr 29, 2022 · 14 comments
Labels
enhancement New feature or request

Comments

@HarGabt
Copy link

HarGabt commented Apr 29, 2022

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.

@xan1242
Copy link
Owner

xan1242 commented Apr 30, 2022 via email

@xan1242 xan1242 added the enhancement New feature or request label Apr 30, 2022
@AeroWidescreen
Copy link
Contributor

AeroWidescreen commented May 1, 2022

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.

@koffiato
Copy link

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

@xan1242
Copy link
Owner

xan1242 commented May 15, 2022

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.

@xan1242 xan1242 changed the title Rumble support in the near future [TODO] Rumble support in the near future Jul 12, 2022
@xan1242
Copy link
Owner

xan1242 commented Jul 12, 2022

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...

@xan1242 xan1242 pinned this issue Jul 12, 2022
@MarioTainaka
Copy link

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

@xan1242
Copy link
Owner

xan1242 commented Jul 12, 2022

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)

@MarioTainaka
Copy link

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.

@xan1242
Copy link
Owner

xan1242 commented Jul 12, 2022

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!

@TorutheRedFox
Copy link
Contributor

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

xbox 360 versions probably would be of more help there

@xan1242
Copy link
Owner

xan1242 commented Aug 17, 2022

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.

@TorutheRedFox
Copy link
Contributor

sick

@AlGhost98
Copy link

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?

@koffiato
Copy link

koffiato commented Mar 2, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants