emoose / OutRun2006Tweaks

Turning and spinning and spinning and turning, woah!
MIT License
21 stars 0 forks source link

[Feature Request] Rumble Support #7

Closed DonelBueno closed 2 weeks ago

DonelBueno commented 3 weeks ago

First of all, thanks for the great mod, I thought some issues would never be fixed on the Steam version since almost nobody has it.

About the request, the PC version is notorious for not having any rumble support. Do you plan to add it?

Xbox button prompts and/or texture injection would also be awesome.

emoose commented 3 weeks ago

Rumble might be difficult since game uses DirectInput, and seems the dinput driver for xinput controllers is actually missing rumble support for whatever reason.

Apparently xidi can let xinput rumble work with dinput but that messes up some of the games controls (and also corrupts your save if you aren't using tweaks 0.2.3+...), controls might be fixable by editing xidi.ini though. If anyone wants to try that out, you can rename the tweaks dinput8.dll to winmm.dll and let xidi use dinput8.dll

When I briefly tried it I didn't get any rumble response though, so game might not even be using dinput rumble at all... If I could figure out where rumble is meant to be applied in the code maybe something could be patched in for it, haven't really been able to work that out yet (guess maybe it could just be tied in to engine acceleration, or maybe sound effects...)

Hoping to figure something for button prompts eventually too, heard the textures are all included in the files already, maybe just have to change a number somewhere to make it switch to different ones.

For texture changes it looks like FXT dev did some work on tools for it, but that might just be for the UI/HUD textures, AFAIK game is using all standard D3DX functions for loading textures in so maybe that could be hooked and redirected to some folder instead, will try checking that out soon.

emoose commented 3 weeks ago

AFAIK game is using all standard D3DX functions for loading textures in so maybe that could be hooked and redirected to some folder instead

Seem to have something working for this, able to dump them out to a folder & also replace them in the game if a DDS exists for it:

24-06-12_14-28-32-356_explorer

With AutoCrispy + texconv.exe + ESRGAN you can get them all upscaled to 4x pretty easily too, didn't notice any visual glitches from it neither (just make sure autocrispy is set to "Force Dx9" in the output texconv chain)

Needs more work on actually loading the textures in though, atm it's just reading from disk whenever game requests it which causes some nasty stutters, some kind of cache would help a lot... Unfortunate that the game is 32bit with 4GB memory limit, upscaled folder is already at 5GB just from playing on 3 stages :/

An alternative could be using something like SpecialK instead, pretty sure that has texture dumping/overrides for DX9 games, can be hit or miss with some older games though, especially 32-bit memory-limited ones.

DonelBueno commented 2 weeks ago

Did you patach the exe to use 4GB instead of 2GB? Anyway, 5GB from upscaled texture is huge. The ones I'm most interested in changing are the HUD/UI ones, they are strechted and low-res. How many textures were dumped in 3 stages?

Great to know you were able to dump and load them. I've already used ESRGAN for some texture packs.

About the rumble, I'm going to give xidi a try, thanks for the tip.

emoose commented 2 weeks ago

Seems the HUD/UI textures are the only ones that method doesn't seem to work with, I think those might be using some D3DXSprite stuff to handle drawing them, maybe just have to look into hooking that too.

4GB patching the exe would probably help, didn't try game out with it yet but guess it would run fine, would still make the texture cache limited to 3GB or so though.. Maybe some "smart" cache could be setup so it could know what stage is loaded in, then it could unload textures for other areas and only cache the current stage instead, hopefully would reduce how much needs to load in, hm...

If you want to try xidi you should be able to fix the controls with this xidi.ini:

[Mapper]
Type=XInputSharedTriggers

[Workarounds]
ActiveVirtualControllerMask=1

Didn't notice any rumble from that on my end though, could be because I'm using Series X controller though

DonelBueno commented 2 weeks ago

I also didn't have any luck with xidi, I'm also using a Series X controller. Anyway, I don't think that's the cause of the issue, the game never had any rumble regardless of the controller used, maybe it simply wasn't implemented.

About the HUD/UI textures, you can dump them, but not load or you can't even dump? FXT can change the button prompts and unstretch the menus, maybe you should look into it.

emoose commented 2 weeks ago

Anyway, I don't think that's the cause of the issue, the game never had any rumble regardless of the controller used, maybe it simply wasn't implemented.

Yeah sadly seems that's the case, tried taking a look in the Xbox ver and found the code for setting vibration there, seems to check stuff like current stage/car/speed/gear to calculate the vibration values, but looks like all of that was stripped out on PC side, what a waste :(

Fortunately most of the Xbox ver is very close to PC though, same memory structures/engine functions/etc, so had a try at copying the functions over from Xbox entirely, took a little work but seem to have something working 😸

I never really played it on Xbox before so not really sure how the games rumble is meant to react like, seems to be working for gear shifts/drifting/crashes/etc, but maybe could still be something missing with it. Here's a build if you'd like to try it: Outrun2006Tweaks-0.2.4-xinputVibrationTest.zip

Make sure to set VibrationMode in the ini to enable it, there's some info about using impulse triggers in there as well.

Also this is using xinput to handle the vibration so shouldn't need to use xidi or anything.

DonelBueno commented 2 weeks ago

I've made a comparison with the PS2 version and everything seems to be working fine, great work! The effects on your test build mimic the PS2 version perfectly.

About the impulse triggers, are you sure the triggers' motors are vibrating? VibrationMode 2 or 3 seem to only change the way the main motors work, but I may be wrong. In the Forza series the impulse triggers have a complete different feel.

emoose commented 2 weeks ago

Seems to be working, if I edit x1nput.ini and only enable triggers there it feels like they work at least, the defaults there did only set it to 0.25x though, maybe hard to notice with that.

If you add these into your game folder does it make any difference for you? x1nput_1.3-C2C.zip

DonelBueno commented 2 weeks ago

Yes, the dll makes the triggers vibrate pretty hard.

Anyway, I think they should vibrate only on acceleration and braking, accordingly. They shouldn't vibrate at crashes or other actions.

DonelBueno commented 2 weeks ago

Feature implemented, closing this issue. I'm going to open a new one for the texture dumping/injection/xbox buttom prompts.

Thanks!