From 3008bfb4d2e4914f2642b4860d79a4a0ecbe0d68 Mon Sep 17 00:00:00 2001 From: mightymikem <97259811+mightymikem@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:04:45 +0100 Subject: [PATCH] Added hummer strength options --- Game Files/HummerExtreme.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Game Files/HummerExtreme.cpp b/Game Files/HummerExtreme.cpp index 57e8682..a6ade73 100644 --- a/Game Files/HummerExtreme.cpp +++ b/Game Files/HummerExtreme.cpp @@ -22,8 +22,11 @@ extern int EnableDamper; extern int DamperStrength; bool init = false; -extern int EnableDamper; -extern int DamperStrength; + +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int ViosityStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ViosityStrength"), 100, settingsFilename); +static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename); + static void(__cdecl* clSteerDualDeviceSetTRQCurveHalfPointOrig)(void* thisParam, int param_1, float param_2, float param_3); static void __cdecl clSteerDualDeviceSetTRQCurveHalfPoint(void* thisParam, int param_1, float param_2, float param_3) { @@ -39,13 +42,15 @@ static void __cdecl clSteerDualDeviceSetVibrate(void* thisParam, int param_1, fl static void(__cdecl* clSteerDualDeviceSetViscosityOrig)(void* thisParam, int param_1, float param_2, float param_3); static void __cdecl clSteerDualDeviceSetViscosity(void* thisParam, int param_1, float param_2, float param_3) { - myTriggers->Friction((double)param_2); + double percentForce = (double)param_2 * (ViosityStrength / 100.0); + myTriggers->Friction(percentForce); return clSteerDualDeviceSetViscosityOrig(thisParam, param_1, param_2, param_3); } static void(__cdecl* clSteerDualDeviceInitCenterOrig)(void* thisParam, int param_1, unsigned char param_2); static void __cdecl clSteerDualDeviceInitCenter(void* thisParam, int param_1, unsigned char param_2) { - myTriggers->Springi(param_2); + double percentForce = (double)param_2 * (SpringStrength / 100.0); + myTriggers->Springi(percentForce); return clSteerDualDeviceInitCenterOrig(thisParam, param_1, param_2); } @@ -71,4 +76,4 @@ void HummerExtreme::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect MH_CreateHook((LPVOID)0x80d0302, clSteerDualDeviceInitCenter, (LPVOID*)&clSteerDualDeviceInitCenterOrig); MH_EnableHook(MH_ALL_HOOKS); } -} \ No newline at end of file +}