updated to 0.9
This commit is contained in:
parent
65747e84b8
commit
bc0bc3543c
@ -10,19 +10,33 @@ struct EffectTriggers {
|
|||||||
void(*LeftRight)(double smallstrength, double largestrength, double length);
|
void(*LeftRight)(double smallstrength, double largestrength, double length);
|
||||||
void(*LeftRightDevice2)(double smallstrength, double largestrength, double length);
|
void(*LeftRightDevice2)(double smallstrength, double largestrength, double length);
|
||||||
void(*Springi)(double strength);
|
void(*Springi)(double strength);
|
||||||
|
void(*Inertia)(double strength);
|
||||||
|
void(*Ramp)(double start, double end, double length);
|
||||||
|
void(*Damper)(double strength);
|
||||||
|
void(*SawtoothUp)(double strength, double length);
|
||||||
|
void(*SawtoothDown)(double strength, double length);
|
||||||
|
void(*Triangle)(double strength, double length);
|
||||||
};
|
};
|
||||||
|
|
||||||
// classes
|
// classes
|
||||||
class EffectCollection {
|
class EffectCollection {
|
||||||
public:
|
public:
|
||||||
int effect_id = 0;
|
int effect_id;
|
||||||
int effect_left_id = 0;
|
int effect_left_id;
|
||||||
int effect_right_id = 0;
|
int effect_right_id;
|
||||||
int effect_friction_id = 0;
|
int effect_leftramp_id;
|
||||||
int effect_leftright_id = 0;
|
int effect_rightramp_id;
|
||||||
int effect_sine_id = 0;
|
int effect_friction_id;
|
||||||
int effect_spring_id = 0;
|
int effect_leftright_id;
|
||||||
int effect_vibration_id = 0;
|
int effect_sine_id;
|
||||||
|
int effect_spring_id;
|
||||||
|
int effect_vibration_id;
|
||||||
|
int effect_inertia_id;
|
||||||
|
int effect_ramp_id;
|
||||||
|
int effect_damper_id;
|
||||||
|
int effect_sawtoothup_id;
|
||||||
|
int effect_sawtoothdown_id;
|
||||||
|
int effect_triangle_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectConstants {
|
class EffectConstants {
|
||||||
|
@ -24,7 +24,7 @@ DeviceGUID=
|
|||||||
EnableRumble=1
|
EnableRumble=1
|
||||||
; Set to 1 to generate log.txt, else 0. Logs will be appended and not cleared.
|
; Set to 1 to generate log.txt, else 0. Logs will be appended and not cleared.
|
||||||
ReverseRumble=0
|
ReverseRumble=0
|
||||||
Logging=1
|
Logging=0
|
||||||
; When a command is set that contradicts a prior command, clear the prior command. Probably should stay as 1.
|
; When a command is set that contradicts a prior command, clear the prior command. Probably should stay as 1.
|
||||||
ResetFeedback=1
|
ResetFeedback=1
|
||||||
; Length of a feedback command. While a long period works fine (as long as ResetFeedback=1), some games may still require shorter ones.
|
; Length of a feedback command. While a long period works fine (as long as ResetFeedback=1), some games may still require shorter ones.
|
||||||
@ -52,19 +52,19 @@ ForceShowDeviceGUIDMessageBox=0
|
|||||||
|
|
||||||
[Daytona Championship USA]
|
[Daytona Championship USA]
|
||||||
GameId=1
|
GameId=1
|
||||||
MinForce=10
|
MinForce=0
|
||||||
MaxForce=75
|
MaxForce=90
|
||||||
FeedbackLength=30000
|
FeedbackLength=30000
|
||||||
ShowButtonNumbersForSetup=0
|
ShowButtonNumbersForSetup=0
|
||||||
ChangeGearsViaPlugin=0
|
ChangeGearsViaPlugin=0
|
||||||
EscapeKeyExitViaPlugin=0
|
EscapeKeyExitViaPlugin=0
|
||||||
MenuMovementViaPlugin=0
|
MenuMovementViaPlugin=0
|
||||||
Gear1=8
|
Gear1=99
|
||||||
Gear2=10
|
Gear2=99
|
||||||
Gear3=9
|
Gear3=99
|
||||||
Gear4=11
|
Gear4=99
|
||||||
GearUp=4
|
GearUp=99
|
||||||
GearDown=5
|
GearDown=99
|
||||||
HideCursor=0
|
HideCursor=0
|
||||||
;Gear buttons pre-set for Logitech G25 Shifter
|
;Gear buttons pre-set for Logitech G25 Shifter
|
||||||
|
|
||||||
@ -75,13 +75,13 @@ FFBMode=0
|
|||||||
|
|
||||||
[Wacky Races]
|
[Wacky Races]
|
||||||
GameId=2
|
GameId=2
|
||||||
MinForce=5
|
MinForce=0
|
||||||
MaxForce=75
|
MaxForce=75
|
||||||
DefaultCentering=15
|
DefaultCentering=15
|
||||||
|
|
||||||
[Chase HQ 2]
|
[Chase HQ 2]
|
||||||
GameId=3
|
GameId=3
|
||||||
MinForce=5
|
MinForce=0
|
||||||
MaxForce=75
|
MaxForce=75
|
||||||
DefaultCentering=15
|
DefaultCentering=15
|
||||||
|
|
||||||
@ -130,36 +130,33 @@ DefaultCentering=15
|
|||||||
|
|
||||||
[InitialD4]
|
[InitialD4]
|
||||||
GameId=16
|
GameId=16
|
||||||
FeedbackLength=500
|
FeedbackLength=600
|
||||||
FFBMode=0
|
FFBMode=0
|
||||||
|
|
||||||
[InitialD4Japan]
|
[InitialD4Japan]
|
||||||
GameId=24
|
GameId=24
|
||||||
FeedbackLength=500
|
FeedbackLength=600
|
||||||
FFBMode=0
|
FFBMode=0
|
||||||
|
|
||||||
[InitialD5]
|
[InitialD5]
|
||||||
GameId=23
|
GameId=23
|
||||||
FeedbackLength=500
|
FeedbackLength=600
|
||||||
FFBMode=0
|
FFBMode=0
|
||||||
|
|
||||||
[InitialD6]
|
[InitialD6]
|
||||||
GameId=8
|
GameId=8
|
||||||
DefaultCentering=30
|
FeedbackLength=600
|
||||||
FeedbackLength=500
|
FFBMode=0
|
||||||
SineDivision=150
|
|
||||||
|
|
||||||
[InitialD7]
|
[InitialD7]
|
||||||
GameId=17
|
GameId=17
|
||||||
DefaultCentering=30
|
FeedbackLength=600
|
||||||
FeedbackLength=500
|
FFBMode=0
|
||||||
SineDivision=150
|
|
||||||
|
|
||||||
[InitialD8]
|
[InitialD8]
|
||||||
GameId=18
|
GameId=18
|
||||||
DefaultCentering=30
|
FeedbackLength=600
|
||||||
FeedbackLength=500
|
FFBMode=0
|
||||||
SineDivision=150
|
|
||||||
|
|
||||||
[Ford Racing]
|
[Ford Racing]
|
||||||
GameId=7
|
GameId=7
|
||||||
@ -212,18 +209,41 @@ MaxForce=100
|
|||||||
FeedbackLength=500
|
FeedbackLength=500
|
||||||
DefaultCentering=-1
|
DefaultCentering=-1
|
||||||
FFBMode=0
|
FFBMode=0
|
||||||
|
ShowButtonNumbersForSetup=0
|
||||||
|
ChangeGearsViaPlugin=0
|
||||||
|
Gear1=99
|
||||||
|
Gear2=99
|
||||||
|
Gear3=99
|
||||||
|
Gear4=99
|
||||||
|
Gear5=99
|
||||||
|
Gear6=99
|
||||||
|
|
||||||
[Outrun 2 Special Tours Deluxe Real]
|
[Outrun 2 Special Tours Deluxe Real]
|
||||||
GameId=35
|
GameId=35
|
||||||
MinForce=0
|
MinForce=0
|
||||||
MaxForce=100
|
MaxForce=100
|
||||||
FeedbackLength=500
|
FeedbackLength=500
|
||||||
|
SpringStrength=50
|
||||||
|
ShowButtonNumbersForSetup=0
|
||||||
|
ChangeGearsViaPlugin=0
|
||||||
|
Gear1=99
|
||||||
|
Gear2=99
|
||||||
|
Gear3=99
|
||||||
|
Gear4=99
|
||||||
|
Gear5=99
|
||||||
|
Gear6=99
|
||||||
|
|
||||||
[WMMT5]
|
[WMMT5]
|
||||||
GameId=9
|
GameId=9
|
||||||
|
MinForce=0
|
||||||
|
MaxForce=35
|
||||||
DefaultCentering=0
|
DefaultCentering=0
|
||||||
FeedbackLength=80
|
FeedbackLength=80
|
||||||
Logging=0
|
Logging=0
|
||||||
|
AlternativeMinForceLeft=0
|
||||||
|
AlternativeMaxForceLeft=-35
|
||||||
|
AlternativeMinForceRight=0
|
||||||
|
AlternativeMaxForceRight=35
|
||||||
|
|
||||||
[Mame 0199 32bit]
|
[Mame 0199 32bit]
|
||||||
GameId=4
|
GameId=4
|
||||||
@ -268,12 +288,21 @@ FFBMode=0
|
|||||||
|
|
||||||
[Road Fighters 3D]
|
[Road Fighters 3D]
|
||||||
GameId=29
|
GameId=29
|
||||||
|
MinForce=0
|
||||||
|
MaxForce=70
|
||||||
|
AlternativeMinForceLeft=0
|
||||||
|
AlternativeMaxForceLeft=-70
|
||||||
|
AlternativeMinForceRight=0
|
||||||
|
AlternativeMaxForceRight=70
|
||||||
FeedbackLength=500
|
FeedbackLength=500
|
||||||
|
Only2D=0
|
||||||
|
HackToSkipMenuError=0
|
||||||
|
HackToCloseLibmovieErrorAuto=0
|
||||||
FFBMode=0
|
FFBMode=0
|
||||||
InputDeviceWheelEnable=0
|
InputDeviceWheelEnable=0
|
||||||
InputDeviceWheelSteeringAxis=0
|
InputDeviceWheelSteeringAxis=99
|
||||||
InputDeviceWheelAcclAxis=1
|
InputDeviceWheelAcclAxis=99
|
||||||
InputDeviceWheelBrakeAxis=2
|
InputDeviceWheelBrakeAxis=99
|
||||||
InputDeviceWheelReverseAxis=0
|
InputDeviceWheelReverseAxis=0
|
||||||
InputDeviceCombinedPedals=0
|
InputDeviceCombinedPedals=0
|
||||||
SteeringDeadzone=2
|
SteeringDeadzone=2
|
||||||
@ -285,31 +314,31 @@ DpadUp=
|
|||||||
DpadDown=
|
DpadDown=
|
||||||
DpadLeft=
|
DpadLeft=
|
||||||
DpadRight=
|
DpadRight=
|
||||||
ExitButton=2
|
ExitButton=99
|
||||||
TestButton=7
|
TestButton=99
|
||||||
ServiceButton=6
|
ServiceButton=99
|
||||||
CreditButton=0
|
CreditButton=99
|
||||||
ViewButton=3
|
ViewButton=99
|
||||||
ThreeDimensionalButton=1
|
ThreeDimensionalButton=99
|
||||||
leverUp=4
|
leverUp=99
|
||||||
leverDown=5
|
leverDown=99
|
||||||
leverLeft=8
|
leverLeft=99
|
||||||
leverRight=9
|
leverRight=99
|
||||||
Device2GUID=
|
Device2GUID=
|
||||||
DpadUpDevice2=
|
DpadUpDevice2=
|
||||||
DpadDownDevice2=
|
DpadDownDevice2=
|
||||||
DpadLeftDevice2=
|
DpadLeftDevice2=
|
||||||
DpadRightDevice2=
|
DpadRightDevice2=
|
||||||
ExitButtonDevice2=2
|
ExitButtonDevice2=99
|
||||||
TestButtonDevice2=7
|
TestButtonDevice2=99
|
||||||
ServiceButtonDevice2=6
|
ServiceButtonDevice2=99
|
||||||
CreditButtonDevice2=0
|
CreditButtonDevice2=99
|
||||||
ViewButtonDevice2=3
|
ViewButtonDevice2=99
|
||||||
ThreeDimensionalButtonDevice2=1
|
ThreeDimensionalButtonDevice2=99
|
||||||
leverUpDevice2=4
|
leverUpDevice2=99
|
||||||
leverDownDevice2=5
|
leverDownDevice2=99
|
||||||
leverLeftDevice2=8
|
leverLeftDevice2=99
|
||||||
leverRightDevice2=9
|
leverRightDevice2=99
|
||||||
|
|
||||||
[Button Rumble 32bit]
|
[Button Rumble 32bit]
|
||||||
GameId=28
|
GameId=28
|
||||||
@ -320,26 +349,26 @@ RightRumbleMotor=0
|
|||||||
RumbleStrength=100
|
RumbleStrength=100
|
||||||
RumbleLength=0
|
RumbleLength=0
|
||||||
Device2GUID=
|
Device2GUID=
|
||||||
Button1Rumble=0
|
Button1Rumble=99
|
||||||
Button2Rumble=1
|
Button2Rumble=99
|
||||||
Button3Rumble=2
|
Button3Rumble=99
|
||||||
Button4Rumble=3
|
Button4Rumble=99
|
||||||
Button5Rumble=4
|
Button5Rumble=99
|
||||||
Button6Rumble=5
|
Button6Rumble=99
|
||||||
Button7Rumble=6
|
Button7Rumble=99
|
||||||
Button8Rumble=7
|
Button8Rumble=99
|
||||||
Button9Rumble=8
|
Button9Rumble=99
|
||||||
Button10Rumble=9
|
Button10Rumble=99
|
||||||
Button1Device2Rumble=0
|
Button1Device2Rumble=99
|
||||||
Button2Device2Rumble=1
|
Button2Device2Rumble=99
|
||||||
Button3Device2Rumble=2
|
Button3Device2Rumble=99
|
||||||
Button4Device2Rumble=3
|
Button4Device2Rumble=99
|
||||||
Button5Device2Rumble=4
|
Button5Device2Rumble=99
|
||||||
Button6Device2Rumble=5
|
Button6Device2Rumble=99
|
||||||
Button7Device2Rumble=6
|
Button7Device2Rumble=99
|
||||||
Button8Device2Rumble=7
|
Button8Device2Rumble=99
|
||||||
Button9Device2Rumble=8
|
Button9Device2Rumble=99
|
||||||
Button10Device2Rumble=9
|
Button10Device2Rumble=99
|
||||||
|
|
||||||
[Button Rumble 64bit]
|
[Button Rumble 64bit]
|
||||||
GameId=36
|
GameId=36
|
||||||
@ -350,26 +379,26 @@ RightRumbleMotor=0
|
|||||||
RumbleStrength=100
|
RumbleStrength=100
|
||||||
RumbleLength=0
|
RumbleLength=0
|
||||||
Device2GUID=
|
Device2GUID=
|
||||||
Button1Rumble=0
|
Button1Rumble=99
|
||||||
Button2Rumble=1
|
Button2Rumble=99
|
||||||
Button3Rumble=2
|
Button3Rumble=99
|
||||||
Button4Rumble=3
|
Button4Rumble=99
|
||||||
Button5Rumble=4
|
Button5Rumble=99
|
||||||
Button6Rumble=5
|
Button6Rumble=99
|
||||||
Button7Rumble=6
|
Button7Rumble=99
|
||||||
Button8Rumble=7
|
Button8Rumble=99
|
||||||
Button9Rumble=8
|
Button9Rumble=99
|
||||||
Button10Rumble=9
|
Button10Rumble=99
|
||||||
Button1Device2Rumble=0
|
Button1Device2Rumble=99
|
||||||
Button2Device2Rumble=1
|
Button2Device2Rumble=99
|
||||||
Button3Device2Rumble=2
|
Button3Device2Rumble=99
|
||||||
Button4Device2Rumble=3
|
Button4Device2Rumble=99
|
||||||
Button5Device2Rumble=4
|
Button5Device2Rumble=99
|
||||||
Button6Device2Rumble=5
|
Button6Device2Rumble=99
|
||||||
Button7Device2Rumble=6
|
Button7Device2Rumble=99
|
||||||
Button8Device2Rumble=7
|
Button8Device2Rumble=99
|
||||||
Button9Device2Rumble=8
|
Button9Device2Rumble=99
|
||||||
Button10Device2Rumble=9
|
Button10Device2Rumble=99
|
||||||
|
|
||||||
[Mario Kart Arcade GP DX v110]
|
[Mario Kart Arcade GP DX v110]
|
||||||
GameId=20
|
GameId=20
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Game Files\FordRacingOther.h" />
|
||||||
<ClInclude Include="Game Files\ButtonRumble64bit.h" />
|
<ClInclude Include="Game Files\ButtonRumble64bit.h" />
|
||||||
|
<ClInclude Include="Game Files\GRID.h" />
|
||||||
<ClInclude Include="Game Files\OutRun2Real.h" />
|
<ClInclude Include="Game Files\OutRun2Real.h" />
|
||||||
<ClInclude Include="Game Files\Mame019964bit.h" />
|
<ClInclude Include="Game Files\Mame019964bit.h" />
|
||||||
<ClInclude Include="Game Files\Mame020664bit.h" />
|
<ClInclude Include="Game Files\Mame020664bit.h" />
|
||||||
@ -42,7 +44,9 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="Game Files\FordRacingOther.cpp" />
|
||||||
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
|
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
|
||||||
|
<ClCompile Include="Game Files\GRID.cpp" />
|
||||||
<ClCompile Include="Game Files\OutRun2Real.cpp" />
|
<ClCompile Include="Game Files\OutRun2Real.cpp" />
|
||||||
<ClCompile Include="Game Files\Mame019964bit.cpp" />
|
<ClCompile Include="Game Files\Mame019964bit.cpp" />
|
||||||
<ClCompile Include="Game Files\Mame020664bit.cpp" />
|
<ClCompile Include="Game Files\Mame020664bit.cpp" />
|
||||||
|
@ -118,6 +118,8 @@
|
|||||||
<Filter>Game Files</Filter>
|
<Filter>Game Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
|
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
|
||||||
|
<ClCompile Include="Game Files\GRID.cpp" />
|
||||||
|
<ClCompile Include="Game Files\FordRacingOther.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Game Files\Daytona3.h">
|
<ClInclude Include="Game Files\Daytona3.h">
|
||||||
@ -238,6 +240,12 @@
|
|||||||
<ClInclude Include="Game Files\ButtonRumble64bit.h">
|
<ClInclude Include="Game Files\ButtonRumble64bit.h">
|
||||||
<Filter>Common Header Files</Filter>
|
<Filter>Common Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Game Files\GRID.h">
|
||||||
|
<Filter>Common Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Game Files\FordRacingOther.h">
|
||||||
|
<Filter>Common Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="Includes\FFBPlugin.txt" />
|
<Text Include="Includes\FFBPlugin.txt" />
|
||||||
|
263
DllMain.cpp
263
DllMain.cpp
@ -18,7 +18,9 @@
|
|||||||
#include "Game Files/ChaseHQ2.h"
|
#include "Game Files/ChaseHQ2.h"
|
||||||
#include "Game Files/Daytona3.h"
|
#include "Game Files/Daytona3.h"
|
||||||
#include "Game Files/FordRacing.h"
|
#include "Game Files/FordRacing.h"
|
||||||
|
#include "Game Files/FordRacingOther.h"
|
||||||
#include "Game Files/FNF.h"
|
#include "Game Files/FNF.h"
|
||||||
|
#include "Game Files/GRID.h"
|
||||||
#include "Game Files/InitialD4.h"
|
#include "Game Files/InitialD4.h"
|
||||||
#include "Game Files/InitialD4Japan.h"
|
#include "Game Files/InitialD4Japan.h"
|
||||||
#include "Game Files/InitialD5.h"
|
#include "Game Files/InitialD5.h"
|
||||||
@ -779,10 +781,19 @@ HRESULT WINAPI DirectInputDirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion,
|
|||||||
// DINPUT8 WRAPPER
|
// DINPUT8 WRAPPER
|
||||||
HRESULT WINAPI DirectInputDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter)
|
HRESULT WINAPI DirectInputDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter)
|
||||||
{
|
{
|
||||||
|
/*wchar_t *settingsFilenameA = TEXT(".\\FFBPlugin.ini");
|
||||||
|
int configGameIdA = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFilenameA);
|
||||||
|
if (configGameIdA == 29)
|
||||||
|
{
|
||||||
|
return DIERR_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{*/
|
||||||
LPVOID val;
|
LPVOID val;
|
||||||
HRESULT res = originalDirectInputDirectInput8Create(hinst, dwVersion, riidltf, &val, punkOuter);
|
HRESULT res = originalDirectInputDirectInput8Create(hinst, dwVersion, riidltf, &val, punkOuter);
|
||||||
*ppvOut = new DirectInputDeviceWrapper(val, (IID_IDirectInput8W == riidltf));
|
*ppvOut = new DirectInputDeviceWrapper(val, (IID_IDirectInput8W == riidltf));
|
||||||
return res;
|
return res;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI DirectInputDllRegisterServer(void)
|
HRESULT WINAPI DirectInputDllRegisterServer(void)
|
||||||
@ -848,7 +859,7 @@ wchar_t *deviceGUIDString = new wchar_t[256];
|
|||||||
int DeviceGUID = GetPrivateProfileString(TEXT("Settings"), TEXT("DeviceGUID"), NULL, deviceGUIDString, 256, settingsFilename);
|
int DeviceGUID = GetPrivateProfileString(TEXT("Settings"), TEXT("DeviceGUID"), NULL, deviceGUIDString, 256, settingsFilename);
|
||||||
int configResetFeedback = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFeedback"), 1, settingsFilename);
|
int configResetFeedback = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFeedback"), 1, settingsFilename);
|
||||||
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||||
int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFilename);
|
int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 0, settingsFilename);
|
||||||
int configDefaultCentering = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultCentering"), 0, settingsFilename);
|
int configDefaultCentering = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultCentering"), 0, settingsFilename);
|
||||||
int configDefaultFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultFriction"), 0, settingsFilename);
|
int configDefaultFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultFriction"), 0, settingsFilename);
|
||||||
int BeepWhenHook = GetPrivateProfileInt(TEXT("Settings"), TEXT("BeepWhenHook"), 0, settingsFilename);
|
int BeepWhenHook = GetPrivateProfileInt(TEXT("Settings"), TEXT("BeepWhenHook"), 0, settingsFilename);
|
||||||
@ -857,7 +868,7 @@ int configAlternativeMinForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT(
|
|||||||
int configAlternativeMaxForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeft"), 100, settingsFilename);
|
int configAlternativeMaxForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeft"), 100, settingsFilename);
|
||||||
int configAlternativeMinForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRight"), 0, settingsFilename);
|
int configAlternativeMinForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRight"), 0, settingsFilename);
|
||||||
int configAlternativeMaxForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRight"), 100, settingsFilename);
|
int configAlternativeMaxForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRight"), 100, settingsFilename);
|
||||||
int ForceShowDeviceGUIDMessageBox = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceShowDeviceGUIDMessageBox"), 100, settingsFilename);
|
int ForceShowDeviceGUIDMessageBox = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceShowDeviceGUIDMessageBox"), 0, settingsFilename);
|
||||||
|
|
||||||
char chainedDLL[256];
|
char chainedDLL[256];
|
||||||
|
|
||||||
@ -867,6 +878,7 @@ const int TEST_GAME_FRICTION = -3;
|
|||||||
const int TEST_GAME_SPRING = -4;
|
const int TEST_GAME_SPRING = -4;
|
||||||
const int TEST_GAME_HEAVY = -5;
|
const int TEST_GAME_HEAVY = -5;
|
||||||
const int TEST_GAME_LOOSE = -6;
|
const int TEST_GAME_LOOSE = -6;
|
||||||
|
const int TEST_GAME_RUMBLE = -7;
|
||||||
|
|
||||||
const int DAYTONA_3 = 1;
|
const int DAYTONA_3 = 1;
|
||||||
const int WACKY_RACES = 2;
|
const int WACKY_RACES = 2;
|
||||||
@ -903,6 +915,8 @@ const int MAME_020664bit = 33;
|
|||||||
const int MAME_019964bit = 34;
|
const int MAME_019964bit = 34;
|
||||||
const int OUTRUN_2Real = 35;
|
const int OUTRUN_2Real = 35;
|
||||||
const int Button_Rumble64bit = 36;
|
const int Button_Rumble64bit = 36;
|
||||||
|
const int GRID_ = 37;
|
||||||
|
const int FORD_RACING_OTHER = 38;
|
||||||
|
|
||||||
HINSTANCE Get_hInstance()
|
HINSTANCE Get_hInstance()
|
||||||
{
|
{
|
||||||
@ -914,7 +928,7 @@ HINSTANCE Get_hInstance()
|
|||||||
void Initialize(int device_index)
|
void Initialize(int device_index)
|
||||||
{
|
{
|
||||||
hlp.log("in initialize");
|
hlp.log("in initialize");
|
||||||
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC);
|
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC | SDL_INIT_TIMER);
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
SDL_JoystickEventState(SDL_ENABLE);
|
||||||
SDL_JoystickUpdate;
|
SDL_JoystickUpdate;
|
||||||
char joystick_guid[256];
|
char joystick_guid[256];
|
||||||
@ -969,7 +983,6 @@ void Initialize(int device_index)
|
|||||||
|
|
||||||
|
|
||||||
SDL_HapticEffect tempEffect;
|
SDL_HapticEffect tempEffect;
|
||||||
|
|
||||||
hlp.log("creating base effects...");
|
hlp.log("creating base effects...");
|
||||||
|
|
||||||
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
@ -1006,10 +1019,52 @@ void Initialize(int device_index)
|
|||||||
tempEffect.condition.length = 5000;
|
tempEffect.condition.length = 5000;
|
||||||
effects.effect_spring_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
effects.effect_spring_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_INERTIA;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = 5000;
|
||||||
|
effects.effect_inertia_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_DAMPER;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = 5000;
|
||||||
|
effects.effect_damper_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_TRIANGLE;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = 5000;
|
||||||
|
effects.effect_triangle_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_RAMP;
|
||||||
|
tempEffect.ramp.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.ramp.delay = 0;
|
||||||
|
tempEffect.ramp.length = 5000;
|
||||||
|
effects.effect_ramp_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_SAWTOOTHUP;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = 5000;
|
||||||
|
effects.effect_sawtoothup_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
|
tempEffect = SDL_HapticEffect();
|
||||||
|
tempEffect.type = SDL_HAPTIC_SAWTOOTHDOWN;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = 5000;
|
||||||
|
effects.effect_sawtoothdown_id = SDL_HapticNewEffect(haptic, &tempEffect);
|
||||||
|
|
||||||
// TODO: why don't we just define this as hackFix = true in the other file?
|
// TODO: why don't we just define this as hackFix = true in the other file?
|
||||||
// Was there a reason to put it here?
|
// Was there a reason to put it here?
|
||||||
extern bool hackFix;
|
// extern bool hackFix;
|
||||||
hackFix = true;
|
// hackFix = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1022,13 +1077,11 @@ std::string lastConstantEffectHash = "";
|
|||||||
std::string lastFrictionEffectHash = "";
|
std::string lastFrictionEffectHash = "";
|
||||||
std::string lastSineEffectHash = "";
|
std::string lastSineEffectHash = "";
|
||||||
std::string lastSpringEffectHash = "";
|
std::string lastSpringEffectHash = "";
|
||||||
|
|
||||||
|
|
||||||
void TriggerConstantEffect(int direction, double strength)
|
void TriggerConstantEffect(int direction, double strength)
|
||||||
{
|
{
|
||||||
if (AlternativeFFB == 1)
|
if (AlternativeFFB == 1)
|
||||||
{
|
{
|
||||||
std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
/*std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
||||||
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
|
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
|
||||||
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
|
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
|
||||||
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
|
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
|
||||||
@ -1038,7 +1091,7 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
return; // same effect, do nothing.
|
return; // same effect, do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: investigate if we need this
|
TODO: investigate if we need this
|
||||||
if (configResetFeedback || strength <= 0.001) {
|
if (configResetFeedback || strength <= 0.001) {
|
||||||
SDL_HapticStopEffect(haptic, effects.effect_left_id);
|
SDL_HapticStopEffect(haptic, effects.effect_left_id);
|
||||||
SDL_HapticStopEffect(haptic, effects.effect_right_id);
|
SDL_HapticStopEffect(haptic, effects.effect_right_id);
|
||||||
@ -1047,10 +1100,8 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
lastConstantEffectHash = effectHash;
|
lastConstantEffectHash = effectHash;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
SDL_HapticEffect tempEffect;
|
SDL_HapticEffect tempEffect;
|
||||||
|
|
||||||
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
tempEffect.type = SDL_HAPTIC_CONSTANT;
|
tempEffect.type = SDL_HAPTIC_CONSTANT;
|
||||||
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
|
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
@ -1065,8 +1116,8 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
SHORT level = (SHORT)(strength * range - minForce);
|
SHORT level = (SHORT)(strength * range - minForce);
|
||||||
tempEffect.constant.level = level;
|
tempEffect.constant.level = level;
|
||||||
hlp.log((char *)(std::to_string(level)).c_str());
|
hlp.log((char *)(std::to_string(level)).c_str());
|
||||||
SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect);
|
SDL_HapticUpdateEffect(haptic, effects.effect_left_id, &tempEffect);
|
||||||
SDL_HapticRunEffect(haptic, effects.effect_id, 1);
|
SDL_HapticRunEffect(haptic, effects.effect_left_id, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1079,15 +1130,15 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
SHORT level = (SHORT)(strength * range + minForce);
|
SHORT level = (SHORT)(strength * range + minForce);
|
||||||
tempEffect.constant.level = level;
|
tempEffect.constant.level = level;
|
||||||
hlp.log((char *)(std::to_string(level)).c_str());
|
hlp.log((char *)(std::to_string(level)).c_str());
|
||||||
SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect);
|
SDL_HapticUpdateEffect(haptic, effects.effect_right_id, &tempEffect);
|
||||||
SDL_HapticRunEffect(haptic, effects.effect_id, 1);
|
SDL_HapticRunEffect(haptic, effects.effect_right_id, 1);
|
||||||
}
|
}
|
||||||
timeOfLastConstantEffect = now;
|
/*timeOfLastConstantEffect = now;
|
||||||
lastConstantEffectHash = effectHash;
|
lastConstantEffectHash = effectHash;*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
/*std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
||||||
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
|
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
|
||||||
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
|
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
|
||||||
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
|
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
|
||||||
@ -1106,10 +1157,11 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
lastConstantEffectHash = effectHash;
|
lastConstantEffectHash = effectHash;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
SDL_HapticEffect tempEffect;
|
SDL_HapticEffect tempEffect;
|
||||||
|
|
||||||
|
|
||||||
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
tempEffect.type = SDL_HAPTIC_CONSTANT;
|
tempEffect.type = SDL_HAPTIC_CONSTANT;
|
||||||
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
|
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
@ -1125,8 +1177,8 @@ void TriggerConstantEffect(int direction, double strength)
|
|||||||
SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect);
|
SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect);
|
||||||
SDL_HapticRunEffect(haptic, effects.effect_id, 1);
|
SDL_HapticRunEffect(haptic, effects.effect_id, 1);
|
||||||
|
|
||||||
timeOfLastConstantEffect = now;
|
/*timeOfLastConstantEffect = now;
|
||||||
lastConstantEffectHash = effectHash;
|
lastConstantEffectHash = effectHash;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,11 +1209,8 @@ void TriggerFrictionEffectWithDefaultOption(double strength, bool isDefault) {
|
|||||||
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
tempEffect.type = SDL_HAPTIC_FRICTION;
|
tempEffect.type = SDL_HAPTIC_FRICTION;
|
||||||
tempEffect.condition.type = SDL_HAPTIC_FRICTION;
|
tempEffect.condition.type = SDL_HAPTIC_FRICTION;
|
||||||
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
|
||||||
tempEffect.condition.delay = 0;
|
tempEffect.condition.delay = 0;
|
||||||
tempEffect.condition.length = isDefault ? 0xFFFFFFFF : configFeedbackLength;
|
tempEffect.condition.length = isDefault ? 0xFFFFFFFF : configFeedbackLength;
|
||||||
tempEffect.condition.direction.dir[0] = 1; // not used
|
|
||||||
tempEffect.constant.direction.dir[1] = 0; //Y Position
|
|
||||||
tempEffect.condition.left_sat[0] = 0xFFFF;
|
tempEffect.condition.left_sat[0] = 0xFFFF;
|
||||||
tempEffect.condition.right_sat[0] = 0xFFFF;
|
tempEffect.condition.right_sat[0] = 0xFFFF;
|
||||||
|
|
||||||
@ -1180,6 +1229,142 @@ void TriggerFrictionEffectWithDefaultOption(double strength, bool isDefault) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TriggerInertiaEffect(double strength)
|
||||||
|
{
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_INERTIA;
|
||||||
|
tempEffect.condition.type = SDL_HAPTIC_INERTIA;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = configFeedbackLength;
|
||||||
|
tempEffect.condition.direction.dir[0] = 1;
|
||||||
|
tempEffect.condition.direction.dir[1] = 1; //Y Position
|
||||||
|
SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT coeff = (SHORT)(strength * range + minForce);
|
||||||
|
|
||||||
|
tempEffect.condition.left_coeff[0] = (short)(coeff);
|
||||||
|
tempEffect.condition.right_coeff[0] = (short)(coeff);
|
||||||
|
tempEffect.condition.left_sat[0] = (short)(coeff) * 10;
|
||||||
|
tempEffect.condition.right_sat[0] = (short)(coeff) * 10;
|
||||||
|
tempEffect.condition.center[0] = 0;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_inertia_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_inertia_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerTriangleEffect(double strength, double length)
|
||||||
|
{
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_TRIANGLE;
|
||||||
|
tempEffect.condition.type = SDL_HAPTIC_TRIANGLE;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.periodic.period = 500;
|
||||||
|
SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT power = (SHORT)(strength * range + minForce);
|
||||||
|
tempEffect.periodic.magnitude = power;
|
||||||
|
tempEffect.periodic.length = length;
|
||||||
|
tempEffect.periodic.attack_length = 1000;
|
||||||
|
tempEffect.periodic.fade_length = 1000;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_triangle_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_triangle_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerDamperEffect(double strength)
|
||||||
|
{
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_DAMPER;
|
||||||
|
tempEffect.condition.type = SDL_HAPTIC_DAMPER;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.condition.delay = 0;
|
||||||
|
tempEffect.condition.length = configFeedbackLength;
|
||||||
|
tempEffect.condition.direction.dir[0] = 1; // not used
|
||||||
|
tempEffect.condition.direction.dir[1] = 0; //Y Position
|
||||||
|
SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT coeff = (SHORT)(strength * range + minForce);
|
||||||
|
tempEffect.condition.left_coeff[0] = (short)(coeff);
|
||||||
|
tempEffect.condition.right_coeff[0] = (short)(coeff);
|
||||||
|
tempEffect.condition.left_sat[0] = (short)(coeff) * 10;
|
||||||
|
tempEffect.condition.right_sat[0] = (short)(coeff) * 10;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_damper_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_damper_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerRampEffect(double start,double end,double length)
|
||||||
|
{
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_RAMP;
|
||||||
|
tempEffect.ramp.type = SDL_HAPTIC_RAMP;
|
||||||
|
tempEffect.ramp.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.ramp.length = length;
|
||||||
|
SHORT minForce = (SHORT)(start > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT start1 = (SHORT)(start * range + minForce);
|
||||||
|
SHORT minForce2 = (SHORT)(end > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce2 = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range2 = maxForce - minForce;
|
||||||
|
SHORT start2 = (SHORT)(end * range + minForce);
|
||||||
|
tempEffect.ramp.delay = 0;
|
||||||
|
tempEffect.ramp.start = start1;
|
||||||
|
tempEffect.ramp.end = -start2;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_ramp_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_ramp_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerSawtoothUpEffect(double strength, double length)
|
||||||
|
{
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_SAWTOOTHUP;
|
||||||
|
tempEffect.condition.type = SDL_HAPTIC_SAWTOOTHUP;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.periodic.period = 500;
|
||||||
|
SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT power = (SHORT)(strength * range + minForce);
|
||||||
|
tempEffect.periodic.magnitude = power;
|
||||||
|
tempEffect.periodic.length = length;
|
||||||
|
tempEffect.periodic.attack_length = 1000;
|
||||||
|
tempEffect.periodic.fade_length = 1000;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_sawtoothup_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_sawtoothup_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TriggerSawtoothDownEffect(double strength, double length) {
|
||||||
|
SDL_HapticEffect tempEffect;
|
||||||
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
|
tempEffect.type = SDL_HAPTIC_SAWTOOTHDOWN;
|
||||||
|
tempEffect.condition.type = SDL_HAPTIC_SAWTOOTHDOWN;
|
||||||
|
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
tempEffect.periodic.period = 500;
|
||||||
|
SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
|
||||||
|
SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
|
||||||
|
SHORT range = maxForce - minForce;
|
||||||
|
SHORT power = (SHORT)(strength * range + minForce);
|
||||||
|
tempEffect.periodic.magnitude = power;
|
||||||
|
tempEffect.periodic.length = length;
|
||||||
|
tempEffect.periodic.attack_length = 1000;
|
||||||
|
tempEffect.periodic.fade_length = 1000;
|
||||||
|
|
||||||
|
SDL_HapticUpdateEffect(haptic, effects.effect_sawtoothdown_id, &tempEffect);
|
||||||
|
SDL_HapticRunEffect(haptic, effects.effect_sawtoothdown_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void TriggerFrictionEffect(double strength)
|
void TriggerFrictionEffect(double strength)
|
||||||
{
|
{
|
||||||
TriggerFrictionEffectWithDefaultOption(strength, false);
|
TriggerFrictionEffectWithDefaultOption(strength, false);
|
||||||
@ -1236,7 +1421,7 @@ void TriggerSineEffect(UINT16 period, UINT16 fadePeriod, double strength)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TriggerSpringEffectWithDefaultOption(double strength, bool isDefault) {
|
void TriggerSpringEffectWithDefaultOption(double strength, bool isDefault) {
|
||||||
std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
/*std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
||||||
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastSpringEffect)).count();
|
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastSpringEffect)).count();
|
||||||
std::string effectHash = std::to_string(effects.effect_spring_id) + "_" + std::to_string(strength);
|
std::string effectHash = std::to_string(effects.effect_spring_id) + "_" + std::to_string(strength);
|
||||||
|
|
||||||
@ -1255,7 +1440,7 @@ void TriggerSpringEffectWithDefaultOption(double strength, bool isDefault) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
SDL_HapticEffect tempEffect;
|
SDL_HapticEffect tempEffect;
|
||||||
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
|
||||||
@ -1281,10 +1466,10 @@ void TriggerSpringEffectWithDefaultOption(double strength, bool isDefault) {
|
|||||||
SDL_HapticUpdateEffect(haptic, effects.effect_spring_id, &tempEffect);
|
SDL_HapticUpdateEffect(haptic, effects.effect_spring_id, &tempEffect);
|
||||||
SDL_HapticRunEffect(haptic, effects.effect_spring_id, 1);
|
SDL_HapticRunEffect(haptic, effects.effect_spring_id, 1);
|
||||||
|
|
||||||
if (!isDefault) {
|
/*if (!isDefault) {
|
||||||
timeOfLastSpringEffect = now;
|
timeOfLastSpringEffect = now;
|
||||||
lastSpringEffectHash = effectHash;
|
lastSpringEffectHash = effectHash;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerSpringEffectInfinite(double strength)
|
void TriggerSpringEffectInfinite(double strength)
|
||||||
@ -1410,7 +1595,6 @@ void TriggerSpringEffect(double strength)
|
|||||||
|
|
||||||
DWORD WINAPI FFBLoop(LPVOID lpParam)
|
DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||||
{
|
{
|
||||||
|
|
||||||
hlp.log("In FFBLoop");
|
hlp.log("In FFBLoop");
|
||||||
Sleep(2500);
|
Sleep(2500);
|
||||||
SDL_HapticStopAll(haptic);
|
SDL_HapticStopAll(haptic);
|
||||||
@ -1427,6 +1611,12 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
|||||||
t.LeftRight = &TriggerLeftRightEffect;
|
t.LeftRight = &TriggerLeftRightEffect;
|
||||||
t.LeftRightDevice2 = &TriggerLeftRightDevice2Effect;
|
t.LeftRightDevice2 = &TriggerLeftRightDevice2Effect;
|
||||||
t.Springi = &TriggerSpringEffectInfinite;
|
t.Springi = &TriggerSpringEffectInfinite;
|
||||||
|
t.Damper = &TriggerDamperEffect;
|
||||||
|
t.Inertia = &TriggerInertiaEffect;
|
||||||
|
t.Ramp = &TriggerRampEffect;
|
||||||
|
t.SawtoothUp = &TriggerSawtoothUpEffect;
|
||||||
|
t.SawtoothDown = &TriggerSawtoothDownEffect;
|
||||||
|
t.Triangle = &TriggerTriangleEffect;
|
||||||
|
|
||||||
Game* game;
|
Game* game;
|
||||||
switch (configGameId) {
|
switch (configGameId) {
|
||||||
@ -1442,9 +1632,15 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
|||||||
case FNF_GAME:
|
case FNF_GAME:
|
||||||
game = new FNF;
|
game = new FNF;
|
||||||
break;
|
break;
|
||||||
|
case GRID_:
|
||||||
|
game = new GRID;
|
||||||
|
break;
|
||||||
case FORD_RACING:
|
case FORD_RACING:
|
||||||
game = new FordRacing;
|
game = new FordRacing;
|
||||||
break;
|
break;
|
||||||
|
case FORD_RACING_OTHER:
|
||||||
|
game = new FordRacingOther;
|
||||||
|
break;
|
||||||
case INITIAL_D_4:
|
case INITIAL_D_4:
|
||||||
game = new InitialD4;
|
game = new InitialD4;
|
||||||
break;
|
break;
|
||||||
@ -1541,6 +1737,7 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
|||||||
case TEST_GAME_SPRING:
|
case TEST_GAME_SPRING:
|
||||||
case TEST_GAME_HEAVY:
|
case TEST_GAME_HEAVY:
|
||||||
case TEST_GAME_LOOSE:
|
case TEST_GAME_LOOSE:
|
||||||
|
case TEST_GAME_RUMBLE:
|
||||||
game = new TestGame;
|
game = new TestGame;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1557,10 +1754,13 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
|||||||
hlp.log("Entering Game's FFBLoop loop");
|
hlp.log("Entering Game's FFBLoop loop");
|
||||||
bool* kr = (bool*)lpParam;
|
bool* kr = (bool*)lpParam;
|
||||||
while (*kr)
|
while (*kr)
|
||||||
|
{
|
||||||
|
if (game != 0)
|
||||||
{
|
{
|
||||||
game->FFBLoop(&effectConst, &hlp, &t);
|
game->FFBLoop(&effectConst, &hlp, &t);
|
||||||
Sleep(16);
|
Sleep(16);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hlp.log("about to exit FFBLoop");
|
hlp.log("about to exit FFBLoop");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1595,7 +1795,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
|
|||||||
hlp.log((char *)(std::to_string(configMinForce)).c_str());
|
hlp.log((char *)(std::to_string(configMinForce)).c_str());
|
||||||
hlp.log((char *)(std::to_string(configMaxForce)).c_str());
|
hlp.log((char *)(std::to_string(configMaxForce)).c_str());
|
||||||
DisableThreadLibraryCalls(hModule);
|
DisableThreadLibraryCalls(hModule);
|
||||||
|
|
||||||
hlp.log("loading original library...");
|
hlp.log("loading original library...");
|
||||||
|
|
||||||
GetPrivateProfileStringA("Settings", "ChainLoad", "", chainedDLL, 256, ".\\FFBplugin.ini");
|
GetPrivateProfileStringA("Settings", "ChainLoad", "", chainedDLL, 256, ".\\FFBplugin.ini");
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "AfterburnerClimax.h"
|
#include "AfterburnerClimax.h"
|
||||||
|
#include "SDL.h"
|
||||||
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
UINT8 ff = helpers->ReadByte(0x08347A5E, /* isRelativeOffset */ false);
|
UINT8 ff = helpers->ReadByte(0x08347A5E, /* isRelativeOffset */ false);
|
||||||
|
|
||||||
helpers->log("got value: ");
|
helpers->log("got value: ");
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
@ -1,151 +1,78 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "BG4JP.h"
|
#include "BG4JP.h"
|
||||||
|
static int SpeedStrength;
|
||||||
void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
|
||||||
int ff = helpers->ReadInt32(0x42EBB0, /* isRelativeOffset */ true);
|
int ff = helpers->ReadInt32(0x42EBB0, /* isRelativeOffset */ true);
|
||||||
float ffspeed = helpers->ReadFloat32(0x3F3000, /* isRelativeOffset */ true);
|
float ffspeed = helpers->ReadFloat32(0x3F3000, /* isRelativeOffset */ true);
|
||||||
float ff2 = helpers->ReadFloat32(0x42EAB4, /* isRelativeOffset */ true);
|
float ff2 = helpers->ReadFloat32(0x42EAB4, /* isRelativeOffset */ true);
|
||||||
|
if ((ffspeed >= 0.1) & (ffspeed <= 15))
|
||||||
|
{
|
||||||
|
SpeedStrength = 10;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 15.01) & (ffspeed <= 35))
|
||||||
|
{
|
||||||
|
SpeedStrength = 20;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 35.01) & (ffspeed <= 55))
|
||||||
|
{
|
||||||
|
SpeedStrength = 30;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 55.01) & (ffspeed <= 75))
|
||||||
|
{
|
||||||
|
SpeedStrength = 40;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 75.01) & (ffspeed <= 90))
|
||||||
|
{
|
||||||
|
SpeedStrength = 51;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 90.01) & (ffspeed <= 110))
|
||||||
|
{
|
||||||
|
SpeedStrength = 62;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 110.01) & (ffspeed <= 130))
|
||||||
|
{
|
||||||
|
SpeedStrength = 75;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 130.01) & (ffspeed <= 150))
|
||||||
|
{
|
||||||
|
SpeedStrength = 90;
|
||||||
|
}
|
||||||
|
else if (ffspeed > 150.01)
|
||||||
|
{
|
||||||
|
SpeedStrength = 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpeedStrength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
helpers->log("got value: ");
|
helpers->log("got value: ");
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
|
||||||
|
if ((2000000 < ff) && (ff < 4000000))
|
||||||
if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 0.1) & (ffspeed <= 15))
|
|
||||||
{
|
{
|
||||||
double percentForce = (0.1);
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = (200);
|
double percentLength = 150;
|
||||||
triggers->Rumble(percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 0.1) & (ffspeed <= 15))
|
else if ((1000000 < ff) && (ff < 1600000))
|
||||||
{
|
{
|
||||||
double percentForce = (0.1);
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = (200);
|
double percentLength = 150;
|
||||||
triggers->Rumble(percentForce, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 15.01) & (ffspeed <= 35))
|
else if ((0.00000000000000000001 < ff2) && (ffspeed > 0.01))
|
||||||
{
|
|
||||||
double percentForce = (0.2);
|
|
||||||
double percentLength = (200);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 15.01) & (ffspeed <= 35))
|
|
||||||
{
|
|
||||||
double percentForce = (0.2);
|
|
||||||
double percentLength = (200);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 35.01) & (ffspeed <= 55))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = (250);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 35.01) & (ffspeed <= 55))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = (250);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 55.01) & (ffspeed <= 75))
|
|
||||||
{
|
|
||||||
double percentForce = (0.4);
|
|
||||||
double percentLength = (280);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 55.01) & (ffspeed <= 75))
|
|
||||||
{
|
|
||||||
double percentForce = (0.4);
|
|
||||||
double percentLength = (280);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 75.01) & (ffspeed <= 90))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = (320);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 75.01) & (ffspeed <= 90))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = (320);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 90.01) & (ffspeed <= 110))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = (370);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 90.01) & (ffspeed <= 110))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = (370);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 110.01) & (ffspeed <= 130))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = (400);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 110.01) & (ffspeed <= 130))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = (400);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 130.01) & (ffspeed <= 150))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = (450);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 130.01) & (ffspeed <= 150))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = (450);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((2000000 < ff) & (ff < 4000000) & (ffspeed > 150.01))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = (500);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((1000000 < ff) & (ff < 1600000) & (ffspeed > 150.01))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = (500);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((0.00000000000000000001 < ff2) & (ffspeed > 0.01))
|
|
||||||
{
|
{
|
||||||
double percentForce = (0.1);
|
double percentForce = (0.1);
|
||||||
double percentLength = (50);
|
double percentLength = (50);
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((0.00000000000000000001 > ff2) & (ffspeed > 0.01))
|
else if ((0.00000000000000000001 > ff2) && (ffspeed > 0.01))
|
||||||
{
|
{
|
||||||
double percentForce = (0.1);
|
double percentForce = (0.1);
|
||||||
double percentLength = (50);
|
double percentLength = (50);
|
||||||
|
@ -7,37 +7,40 @@ extern int joystick_index2;
|
|||||||
extern SDL_Joystick* GameController2;
|
extern SDL_Joystick* GameController2;
|
||||||
extern SDL_Haptic* ControllerHaptic2;
|
extern SDL_Haptic* ControllerHaptic2;
|
||||||
extern SDL_Haptic* haptic2;
|
extern SDL_Haptic* haptic2;
|
||||||
|
static SDL_Event e;
|
||||||
|
|
||||||
|
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
|
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||||
|
static int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
|
||||||
|
static int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename);
|
||||||
|
static int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename);
|
||||||
|
static int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename);
|
||||||
|
static int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename);
|
||||||
|
static int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename);
|
||||||
|
static int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename);
|
||||||
|
static int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename);
|
||||||
|
static int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename);
|
||||||
|
static int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename);
|
||||||
|
static int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename);
|
||||||
|
static int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename);
|
||||||
|
|
||||||
void ButtonRumble32bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void ButtonRumble32bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
while (SDL_WaitEvent(&e) != 0)
|
||||||
int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
{
|
||||||
int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename);
|
|
||||||
int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename);
|
|
||||||
int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename);
|
|
||||||
int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
|
|
||||||
int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename);
|
|
||||||
int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename);
|
|
||||||
int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename);
|
|
||||||
int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename);
|
|
||||||
int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename);
|
|
||||||
int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename);
|
|
||||||
int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename);
|
|
||||||
int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename);
|
|
||||||
int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename);
|
|
||||||
int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename);
|
|
||||||
int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename);
|
|
||||||
int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename);
|
|
||||||
|
|
||||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||||
{
|
{
|
||||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||||
@ -80,10 +83,6 @@ void ButtonRumble32bit::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Event e;
|
|
||||||
while (SDL_PollEvent(&e) != 0)
|
|
||||||
{
|
|
||||||
if (ShowButtonNumbersForSetup == 1)
|
if (ShowButtonNumbersForSetup == 1)
|
||||||
{
|
{
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
@ -152,66 +151,6 @@ void ButtonRumble32bit::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
{
|
{
|
||||||
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
||||||
}
|
}
|
||||||
else if (e.jbutton.button == 16)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 16 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 17)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 17 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 18)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 18 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 19)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 19 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 20)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 20 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 21)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 21 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 22)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 22 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 23)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 23 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 24)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 24 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 25)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 25 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 26)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 26 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 27)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 27 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 28)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 28 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 29)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 29 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 30)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 30 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
@ -7,37 +7,40 @@ extern int joystick_index2;
|
|||||||
extern SDL_Joystick* GameController2;
|
extern SDL_Joystick* GameController2;
|
||||||
extern SDL_Haptic* ControllerHaptic2;
|
extern SDL_Haptic* ControllerHaptic2;
|
||||||
extern SDL_Haptic* haptic2;
|
extern SDL_Haptic* haptic2;
|
||||||
|
static SDL_Event e;
|
||||||
|
|
||||||
|
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
|
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||||
|
static int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename);
|
||||||
|
static int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
|
||||||
|
static int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename);
|
||||||
|
static int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename);
|
||||||
|
static int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename);
|
||||||
|
static int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename);
|
||||||
|
static int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename);
|
||||||
|
static int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename);
|
||||||
|
static int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename);
|
||||||
|
static int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename);
|
||||||
|
static int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename);
|
||||||
|
static int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename);
|
||||||
|
static int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename);
|
||||||
|
static int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename);
|
||||||
|
|
||||||
void ButtonRumble64bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void ButtonRumble64bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
while (SDL_WaitEvent(&e) != 0)
|
||||||
int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
{
|
||||||
int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename);
|
|
||||||
int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename);
|
|
||||||
int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename);
|
|
||||||
int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
|
|
||||||
int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename);
|
|
||||||
int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename);
|
|
||||||
int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename);
|
|
||||||
int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename);
|
|
||||||
int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename);
|
|
||||||
int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename);
|
|
||||||
int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename);
|
|
||||||
int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename);
|
|
||||||
int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename);
|
|
||||||
int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename);
|
|
||||||
int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename);
|
|
||||||
int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename);
|
|
||||||
int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename);
|
|
||||||
|
|
||||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||||
{
|
{
|
||||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||||
@ -80,10 +83,6 @@ void ButtonRumble64bit::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Event e;
|
|
||||||
while (SDL_PollEvent(&e) != 0)
|
|
||||||
{
|
|
||||||
if (ShowButtonNumbersForSetup == 1)
|
if (ShowButtonNumbersForSetup == 1)
|
||||||
{
|
{
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
@ -152,66 +151,6 @@ void ButtonRumble64bit::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
{
|
{
|
||||||
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
||||||
}
|
}
|
||||||
else if (e.jbutton.button == 16)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 16 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 17)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 17 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 18)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 18 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 19)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 19 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 20)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 20 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 21)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 21 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 22)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 22 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 23)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 23 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 24)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 24 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 25)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 25 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 26)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 26 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 27)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 27 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 28)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 28 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 29)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 29 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 30)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 30 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
@ -2,35 +2,115 @@
|
|||||||
#include "Daytona3.h"
|
#include "Daytona3.h"
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
static EffectTriggers *myTriggers;
|
||||||
|
static EffectConstants *myConstants;
|
||||||
|
static Helpers *myHelpers;
|
||||||
|
static SDL_Event e;
|
||||||
|
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
|
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||||
|
static int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
||||||
|
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
||||||
|
static int MenuMovementViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("MenuMovementViaPlugin"), 0, settingsFilename);
|
||||||
|
static int Gear1 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear1"), 0, settingsFilename);
|
||||||
|
static int Gear2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear2"), 0, settingsFilename);
|
||||||
|
static int Gear3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear3"), 0, settingsFilename);
|
||||||
|
static int Gear4 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear4"), 0, settingsFilename);
|
||||||
|
static int GearUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearUp"), 0, settingsFilename);
|
||||||
|
static int GearDown = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearDown"), 0, settingsFilename);
|
||||||
|
static int HideCursor = GetPrivateProfileInt(TEXT("Settings"), TEXT("HideCursor"), 0, settingsFilename);
|
||||||
|
|
||||||
void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
static int RunningThread(void *ptr)
|
||||||
int ff = helpers->ReadInt32(0x15AFC46, /* isRelativeOffset */ false);
|
{
|
||||||
int gamestate = helpers->ReadInt32(0x19B5744, /* isRelativeOffset */ false);
|
int cnt;
|
||||||
UINT8 gear = helpers->ReadByte(0x019B468C, /* isRelativeOffset */ false);
|
for (cnt = 0; cnt >= 0; ++cnt)
|
||||||
UINT8 steering = helpers->ReadByte(0x019B4678, /* isRelativeOffset */ false);
|
{
|
||||||
helpers->log("got value: ");
|
UINT8 steering = myHelpers->ReadByte(0x019B4678, /* isRelativeOffset */ false);
|
||||||
std::string ffs = std::to_string(ff);
|
int gamestate = myHelpers->ReadInt32(0x19B5744, /* isRelativeOffset */ false);
|
||||||
helpers->log((char *)ffs.c_str());
|
int ff = myHelpers->ReadInt32(0x15AFC46, /* isRelativeOffset */ false);
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
|
||||||
int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
|
||||||
int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
|
||||||
int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
|
||||||
int MenuMovementViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("MenuMovementViaPlugin"), 0, settingsFilename);
|
|
||||||
int Gear1 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear1"), 0, settingsFilename);
|
|
||||||
int Gear2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear2"), 0, settingsFilename);
|
|
||||||
int Gear3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear3"), 0, settingsFilename);
|
|
||||||
int Gear4 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear4"), 0, settingsFilename);
|
|
||||||
int GearUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearUp"), 0, settingsFilename);
|
|
||||||
int GearDown = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearDown"), 0, settingsFilename);
|
|
||||||
int HideCursor = GetPrivateProfileInt(TEXT("Settings"), TEXT("HideCursor"), 0, settingsFilename);
|
|
||||||
|
|
||||||
if (HideCursor == 1)
|
if (HideCursor == 1)
|
||||||
{
|
{
|
||||||
SetCursorPos(2000, 2000);
|
SetCursorPos(2000, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Event e;
|
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
|
||||||
while (SDL_PollEvent(&e) != 0)
|
{
|
||||||
|
HWND hWnd = FindWindowA(0, ("Daytona Championship USA"));
|
||||||
|
if (hWnd > NULL)
|
||||||
|
{
|
||||||
|
//SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
|
system("taskkill /f /im InpWrapper.exe");
|
||||||
|
TerminateProcess(GetCurrentProcess(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((steering > 137) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_RIGHT, 0x25, 0, 0);
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
Sleep(100);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
else if ((steering > 117 & steering < 138) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
else if ((steering < 118) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_LEFT, 0x25, 0, 0);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
Sleep(100);
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((steering > 137) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_RIGHT, 0x25, 0, 0);
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
Sleep(100);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
else if ((steering > 117 & steering < 138) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
else if ((steering < 118) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
||||||
|
{
|
||||||
|
keybd_event(VK_LEFT, 0x25, 0, 0);
|
||||||
|
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
Sleep(100);
|
||||||
|
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ff > 15)
|
||||||
|
{
|
||||||
|
double percentForce = (31 - ff) / 15.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
|
}
|
||||||
|
else if (ff > 0)
|
||||||
|
{
|
||||||
|
double percentForce = (16 - ff) / 15.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
SDL_Thread *thread;
|
||||||
|
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||||
|
UINT8 gear = helpers->ReadByte(0x019B468C, /* isRelativeOffset */ false);
|
||||||
|
int ff = helpers->ReadInt32(0x15AFC46, /* isRelativeOffset */ false);
|
||||||
|
helpers->log("got value: ");
|
||||||
|
std::string ffs = std::to_string(ff);
|
||||||
|
helpers->log((char *)ffs.c_str());
|
||||||
|
while (SDL_WaitEvent(&e) != 0)
|
||||||
{
|
{
|
||||||
/* if (e.type == SDL_KEYDOWN)
|
/* if (e.type == SDL_KEYDOWN)
|
||||||
{
|
{
|
||||||
@ -39,6 +119,9 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
|||||||
MessageBoxA(NULL, "test", "", 0);
|
MessageBoxA(NULL, "test", "", 0);
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
|
myTriggers = triggers;
|
||||||
|
myConstants = constants;
|
||||||
|
myHelpers = helpers;
|
||||||
if (ShowButtonNumbersForSetup == 1)
|
if (ShowButtonNumbersForSetup == 1)
|
||||||
{
|
{
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
@ -107,66 +190,6 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
|||||||
{
|
{
|
||||||
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
||||||
}
|
}
|
||||||
else if (e.jbutton.button == 16)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 16 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 17)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 17 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 18)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 18 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 19)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 19 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 20)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 20 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 21)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 21 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 22)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 22 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 23)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 23 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 24)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 24 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 25)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 25 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 26)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 26 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 27)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 27 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 28)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 28 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 29)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 29 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
else if (e.jbutton.button == 30)
|
|
||||||
{
|
|
||||||
MessageBoxA(NULL, "Button 30 Pressed", "", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.type == SDL_JOYBUTTONDOWN)
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
@ -200,78 +223,4 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
|
|
||||||
{
|
|
||||||
system("taskkill /f /im Daytona.exe");
|
|
||||||
system("taskkill /f /im InpWrapper.exe");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((steering > 137) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_RIGHT, 0x25, 0, 0);
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
Sleep(100);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
else if ((steering > 117 & steering < 138) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
else if ((steering < 118) & (gamestate == 18) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_LEFT, 0x25, 0, 0);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
Sleep(100);
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
if ((steering > 137) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_RIGHT, 0x25, 0, 0);
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
Sleep(100);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
else if ((steering > 117 & steering < 138) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
else if ((steering < 118) & (gamestate == 30) && (MenuMovementViaPlugin == 1))
|
|
||||||
{
|
|
||||||
keybd_event(VK_LEFT, 0x25, 0, 0);
|
|
||||||
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
Sleep(100);
|
|
||||||
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ff > 15)
|
|
||||||
{
|
|
||||||
helpers->log("moving wheel right");
|
|
||||||
// assume that 30 is the weakest and 16 is the strongest
|
|
||||||
double percentForce = (31 - ff) / 15.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
// direction from left => makes wheel turn right
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff
|
|
||||||
lastWasStop = 0;
|
|
||||||
}
|
|
||||||
else if (ff > 0)
|
|
||||||
{
|
|
||||||
helpers->log("moving wheel left");
|
|
||||||
// assume that 1 is the strongest and 15 is the weakest
|
|
||||||
double percentForce = (16 - ff) / 15.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
// direction from right => makes wheel turn left
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff
|
|
||||||
lastWasStop = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (lastWasStop == 0) {
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
|
||||||
lastWasStop = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,17 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "FNF.h"
|
#include "FNF.h"
|
||||||
|
|
||||||
|
void FNF::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers)
|
||||||
void FNF::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
{
|
||||||
|
//HMODULE hMod = GetModuleHandleA("dinput8.dll");
|
||||||
|
/*if (hMod)
|
||||||
|
{
|
||||||
|
void* fn = GetProcAddress(hMod, "GetdfDIJoystick");
|
||||||
|
helpers->WriteNop((INT_PTR)fn + 0x5C0C, false);
|
||||||
|
helpers->WriteNop((INT_PTR)fn + 0x5C0D, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "fuck", "", 0);
|
||||||
|
} */
|
||||||
}
|
}
|
72
Game Files/FordRacingOther.cpp
Normal file
72
Game Files/FordRacingOther.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <string>
|
||||||
|
#include "FordRacingOther.h"
|
||||||
|
static EffectTriggers *myTriggers;
|
||||||
|
static EffectConstants *myConstants;
|
||||||
|
static Helpers *myHelpers;
|
||||||
|
static int __stdcall Out32(DWORD device, DWORD data)
|
||||||
|
{
|
||||||
|
if (device == 0x378)
|
||||||
|
{
|
||||||
|
if (data > 0xFFFF0013 && data < 0xFFFF001F)
|
||||||
|
{
|
||||||
|
double percentForce = (4294901791 - data) / 10.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
|
}
|
||||||
|
else if (data > 5 && data < 16)
|
||||||
|
{
|
||||||
|
double percentForce = (16 - data) / 10.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool Hook(void * toHook, void * ourFunct, int len) {
|
||||||
|
if (len < 5) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD curProtection;
|
||||||
|
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
|
||||||
|
|
||||||
|
memset(toHook, 0x90, len);
|
||||||
|
|
||||||
|
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
|
||||||
|
|
||||||
|
*(BYTE*)toHook = 0xE9;
|
||||||
|
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
|
||||||
|
|
||||||
|
DWORD temp;
|
||||||
|
VirtualProtect(toHook, len, curProtection, &temp);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD jmpBackAddy;
|
||||||
|
|
||||||
|
void FordRacingOther::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
bool init = false;
|
||||||
|
HMODULE hMod = GetModuleHandleA("inpout32.dll");
|
||||||
|
if (hMod)
|
||||||
|
{
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
int hookLength = 6;
|
||||||
|
DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32");
|
||||||
|
if (hookAddress)
|
||||||
|
{
|
||||||
|
jmpBackAddy = hookAddress + hookLength;
|
||||||
|
Hook((void*)hookAddress, Out32, hookLength);
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myTriggers = triggers;
|
||||||
|
myConstants = constants;
|
||||||
|
myHelpers = helpers;
|
||||||
|
}
|
7
Game Files/FordRacingOther.h
Normal file
7
Game Files/FordRacingOther.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../Common Files/Game.h"
|
||||||
|
class FordRacingOther : public Game {
|
||||||
|
|
||||||
|
public:
|
||||||
|
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||||
|
};
|
56
Game Files/GRID.cpp
Normal file
56
Game Files/GRID.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include "GRID.h"
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
static bool __stdcall Out32(int a2, DWORD BytesReturned)
|
||||||
|
{
|
||||||
|
static char test[256];
|
||||||
|
memset(test, 0, 256);
|
||||||
|
sprintf(test, "hex print: %08X", BytesReturned);
|
||||||
|
OutputDebugStringA(test);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool Hook(void * toHook, void * ourFunct, int len) {
|
||||||
|
if (len < 5) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD curProtection;
|
||||||
|
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
|
||||||
|
|
||||||
|
memset(toHook, 0x90, len);
|
||||||
|
|
||||||
|
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
|
||||||
|
|
||||||
|
*(BYTE*)toHook = 0xE9;
|
||||||
|
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
|
||||||
|
|
||||||
|
DWORD temp;
|
||||||
|
VirtualProtect(toHook, len, curProtection, &temp);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD jmpBackAddy;
|
||||||
|
|
||||||
|
void GRID::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||||
|
{
|
||||||
|
bool init = false;
|
||||||
|
HMODULE hMod = GetModuleHandleA("inpout32.dll");
|
||||||
|
if (hMod)
|
||||||
|
{
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
int hookLength = 6;
|
||||||
|
DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32");
|
||||||
|
if (hookAddress)
|
||||||
|
{
|
||||||
|
jmpBackAddy = hookAddress + hookLength;
|
||||||
|
Hook((void*)hookAddress, Out32, hookLength);
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
Game Files/GRID.h
Normal file
7
Game Files/GRID.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../Common Files/Game.h"
|
||||||
|
|
||||||
|
class GRID : public Game {
|
||||||
|
public:
|
||||||
|
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||||
|
};
|
@ -8,40 +8,71 @@ void InitialD4::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTr
|
|||||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
UINT8 ff = helpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false);
|
UINT8 ff = helpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false);
|
||||||
UINT8 ff1 = helpers->ReadByte(0x089AE899, /* isRelativeOffset */ false);
|
UINT8 ff1 = helpers->ReadByte(0x089AE899, /* isRelativeOffset */ false);
|
||||||
|
UINT8 ff2 = helpers->ReadByte(0x089AE898, /* isRelativeOffset */ false);
|
||||||
helpers->log("got value: ");
|
helpers->log("got value: ");
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
|
||||||
if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0))
|
if (ff2 == 0x86)
|
||||||
|
{
|
||||||
|
triggers->Spring(0.8);
|
||||||
|
}
|
||||||
|
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||||
|
{
|
||||||
|
if (ff1 > 0)
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (0.6);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
helpers->log("moving wheel right");
|
||||||
double percentForce = (128 - ff) / 73.0;
|
double percentForce = (128 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 55) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel left");
|
||||||
|
double percentForce = (ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (73 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel right");
|
||||||
|
double percentForce = (128 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0))
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
helpers->log("moving wheel left");
|
||||||
double percentForce = (ff) / 73.0;
|
double percentForce = (ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1))
|
}
|
||||||
{
|
|
||||||
helpers->log("moving wheel right");
|
|
||||||
double percentForce = (128 - ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1))
|
|
||||||
{
|
|
||||||
helpers->log("moving wheel left");
|
|
||||||
double percentForce = (ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT,(pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,40 +7,71 @@ void InitialD4Japan::FFBLoop(EffectConstants * constants, Helpers * helpers, Eff
|
|||||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
UINT8 ff = helpers->ReadByte(0x0898985A, /* isRelativeOffset */ false);
|
UINT8 ff = helpers->ReadByte(0x0898985A, /* isRelativeOffset */ false);
|
||||||
UINT8 ff1 = helpers->ReadByte(0x08989859, /* isRelativeOffset */ false);
|
UINT8 ff1 = helpers->ReadByte(0x08989859, /* isRelativeOffset */ false);
|
||||||
|
UINT8 ff2 = helpers->ReadByte(0x08989858, /* isRelativeOffset */ false);
|
||||||
helpers->log("got value: ");
|
helpers->log("got value: ");
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
|
||||||
if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0))
|
if (ff2 == 0x86)
|
||||||
|
{
|
||||||
|
triggers->Spring(0.8);
|
||||||
|
}
|
||||||
|
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||||
|
{
|
||||||
|
if (ff1 > 0)
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (0.6);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
helpers->log("moving wheel right");
|
||||||
double percentForce = (128 - ff) / 73.0;
|
double percentForce = (128 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 55) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel left");
|
||||||
|
double percentForce = (ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (73 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel right");
|
||||||
|
double percentForce = (128 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0))
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
helpers->log("moving wheel left");
|
||||||
double percentForce = (ff) / 73.0;
|
double percentForce = (ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1))
|
}
|
||||||
{
|
|
||||||
helpers->log("moving wheel right");
|
|
||||||
double percentForce = (128 - ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1))
|
|
||||||
{
|
|
||||||
helpers->log("moving wheel left");
|
|
||||||
double percentForce = (ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,44 +3,76 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||||
|
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
UINT8 ff = helpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false);
|
UINT8 ff = helpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false);
|
||||||
UINT8 ff1 = helpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false);
|
UINT8 ff1 = helpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false);
|
||||||
|
UINT8 ff2 = helpers->ReadByte(0x08CB6120, /* isRelativeOffset */ false);
|
||||||
helpers->log("got value: ");
|
helpers->log("got value: ");
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
|
||||||
if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0))
|
if (ff2 == 0x86)
|
||||||
|
{
|
||||||
|
triggers->Spring(0.8);
|
||||||
|
}
|
||||||
|
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||||
|
{
|
||||||
|
if (ff1 > 0)
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (0.6);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
helpers->log("moving wheel right");
|
||||||
double percentForce = (128 - ff) / 73.0;
|
double percentForce = (128 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 55) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel left");
|
||||||
|
double percentForce = (ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (73 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ff2 == 0x84)
|
||||||
|
{
|
||||||
|
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||||
|
{
|
||||||
|
helpers->log("moving wheel right");
|
||||||
|
double percentForce = (128 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0))
|
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
helpers->log("moving wheel left");
|
||||||
double percentForce = (ff) / 73.0;
|
double percentForce = (ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1))
|
}
|
||||||
{
|
|
||||||
helpers->log("moving wheel right");
|
|
||||||
double percentForce = (128 - ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1))
|
|
||||||
{
|
|
||||||
helpers->log("moving wheel left");
|
|
||||||
double percentForce = (ff) / 73.0;
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,93 +1,185 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "InitialD6.h"
|
#include "InitialD6.h"
|
||||||
|
|
||||||
|
static int carscollide(int ffcollide) {
|
||||||
|
switch (ffcollide) {
|
||||||
|
case 0x50F05:
|
||||||
|
return 16;
|
||||||
|
case 0x50E05:
|
||||||
|
return 15;
|
||||||
|
case 0x50D05:
|
||||||
|
return 14;
|
||||||
|
case 0x50C05:
|
||||||
|
return 13;
|
||||||
|
case 0x50B05:
|
||||||
|
return 12;
|
||||||
|
case 0x50A05:
|
||||||
|
return 11;
|
||||||
|
case 0x50905:
|
||||||
|
return 10;
|
||||||
|
case 0x50805:
|
||||||
|
return 9;
|
||||||
|
case 0x50705:
|
||||||
|
return 8;
|
||||||
|
case 0x50605:
|
||||||
|
return 7;
|
||||||
|
case 0x050505:
|
||||||
|
return 6;
|
||||||
|
case 0x050405:
|
||||||
|
return 5;
|
||||||
|
case 0x050305:
|
||||||
|
return 4;
|
||||||
|
case 0x50205:
|
||||||
|
return 3;
|
||||||
|
case 0x50105:
|
||||||
|
return 2;
|
||||||
|
case 0x50005:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rubbingwalls(int ffwalls) {
|
||||||
|
switch (ffwalls) {
|
||||||
|
case 0x51F08:
|
||||||
|
return 31;
|
||||||
|
case 0x51E08:
|
||||||
|
return 30;
|
||||||
|
case 0x51D08:
|
||||||
|
return 29;
|
||||||
|
case 0x51C08:
|
||||||
|
return 28;
|
||||||
|
case 0x51B08:
|
||||||
|
return 27;
|
||||||
|
case 0x51A08:
|
||||||
|
return 26;
|
||||||
|
case 0x51908:
|
||||||
|
return 25;
|
||||||
|
case 0x51808:
|
||||||
|
return 24;
|
||||||
|
case 0x51708:
|
||||||
|
return 23;
|
||||||
|
case 0x51608:
|
||||||
|
return 22;
|
||||||
|
case 0x51508:
|
||||||
|
return 21;
|
||||||
|
case 0x51408:
|
||||||
|
return 20;
|
||||||
|
case 0x51308:
|
||||||
|
return 19;
|
||||||
|
case 0x51208:
|
||||||
|
return 18;
|
||||||
|
case 0x51108:
|
||||||
|
return 17;
|
||||||
|
case 0x50F08:
|
||||||
|
return 16;
|
||||||
|
case 0x50E08:
|
||||||
|
return 15;
|
||||||
|
case 0x50D08:
|
||||||
|
return 14;
|
||||||
|
case 0x50C08:
|
||||||
|
return 13;
|
||||||
|
case 0x50B08:
|
||||||
|
return 12;
|
||||||
|
case 0x50A08:
|
||||||
|
return 11;
|
||||||
|
case 0x50908:
|
||||||
|
return 10;
|
||||||
|
case 0x50808:
|
||||||
|
return 9;
|
||||||
|
case 0x50708:
|
||||||
|
return 8;
|
||||||
|
case 0x50608:
|
||||||
|
return 7;
|
||||||
|
case 0x50508:
|
||||||
|
return 6;
|
||||||
|
case 0x50408:
|
||||||
|
return 5;
|
||||||
|
case 0x50308:
|
||||||
|
return 4;
|
||||||
|
case 0x50208:
|
||||||
|
return 3;
|
||||||
|
case 0x50108:
|
||||||
|
return 2;
|
||||||
|
case 0x50008:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InitialD6::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
void InitialD6::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||||
|
{
|
||||||
|
int ffrubbingwalls = 0;
|
||||||
|
int ffcarcollision = 0;
|
||||||
{
|
{
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
helpers->log("in ID6 Ffbloop");
|
helpers->log("in ID6 Ffbloop");
|
||||||
const int ff = GetTeknoParrotFFB();
|
const int ff = GetTeknoParrotFFB();
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
ffcarcollision = carscollide(ff);
|
||||||
|
ffrubbingwalls = rubbingwalls(ff);
|
||||||
|
|
||||||
if ((ff > 0x4005B) & (ff < 0x40080))
|
if (ff == 0x60000)
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
triggers->Spring(0.8);
|
||||||
double percentForce = (262272 - ff) / 36.0;
|
}
|
||||||
|
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffrubbingwalls / 31.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffcarcollision / 16.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 262199) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
|
{
|
||||||
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (262473 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x40100) & (ff < 0x40125))
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
double percentForce = (ff - 262400) / 36.0;
|
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff >= 390001) && (ff <= 399999))
|
}
|
||||||
{
|
|
||||||
helpers->log("sine1");
|
|
||||||
double percentForce = (ff - 390000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(120, 100, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 380001) && (ff <= 389999))
|
|
||||||
{
|
|
||||||
helpers->log("sine2");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 380000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(130, 120, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 370001) && (ff <= 379999))
|
|
||||||
{
|
|
||||||
helpers->log("sine3");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 370000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(140, 140, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 360001) && (ff <= 369999))
|
|
||||||
{
|
|
||||||
helpers->log("sine4");
|
|
||||||
double percentForce = (ff - 360000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(150, 150, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 350001) && (ff <= 359999))
|
|
||||||
{
|
|
||||||
helpers->log("sine5");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 350000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(160, 160, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 340001) && (ff <= 349999))
|
|
||||||
{
|
|
||||||
helpers->log("sine6");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 340000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(170, 170, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 330001) && (ff <= 339999))
|
|
||||||
{
|
|
||||||
helpers->log("sine7");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 330000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(180, 180, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 327681) && (ff <= 329999))
|
|
||||||
{
|
|
||||||
helpers->log("sine8");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 327680) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(190, 190, percentForce);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,93 +1,185 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "InitialD7.h"
|
#include "InitialD7.h"
|
||||||
|
|
||||||
|
static int carscollide(int ffcollide) {
|
||||||
|
switch (ffcollide) {
|
||||||
|
case 0x50F05:
|
||||||
|
return 16;
|
||||||
|
case 0x50E05:
|
||||||
|
return 15;
|
||||||
|
case 0x50D05:
|
||||||
|
return 14;
|
||||||
|
case 0x50C05:
|
||||||
|
return 13;
|
||||||
|
case 0x50B05:
|
||||||
|
return 12;
|
||||||
|
case 0x50A05:
|
||||||
|
return 11;
|
||||||
|
case 0x50905:
|
||||||
|
return 10;
|
||||||
|
case 0x50805:
|
||||||
|
return 9;
|
||||||
|
case 0x50705:
|
||||||
|
return 8;
|
||||||
|
case 0x50605:
|
||||||
|
return 7;
|
||||||
|
case 0x050505:
|
||||||
|
return 6;
|
||||||
|
case 0x050405:
|
||||||
|
return 5;
|
||||||
|
case 0x050305:
|
||||||
|
return 4;
|
||||||
|
case 0x50205:
|
||||||
|
return 3;
|
||||||
|
case 0x50105:
|
||||||
|
return 2;
|
||||||
|
case 0x50005:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rubbingwalls(int ffwalls) {
|
||||||
|
switch (ffwalls) {
|
||||||
|
case 0x51F08:
|
||||||
|
return 31;
|
||||||
|
case 0x51E08:
|
||||||
|
return 30;
|
||||||
|
case 0x51D08:
|
||||||
|
return 29;
|
||||||
|
case 0x51C08:
|
||||||
|
return 28;
|
||||||
|
case 0x51B08:
|
||||||
|
return 27;
|
||||||
|
case 0x51A08:
|
||||||
|
return 26;
|
||||||
|
case 0x51908:
|
||||||
|
return 25;
|
||||||
|
case 0x51808:
|
||||||
|
return 24;
|
||||||
|
case 0x51708:
|
||||||
|
return 23;
|
||||||
|
case 0x51608:
|
||||||
|
return 22;
|
||||||
|
case 0x51508:
|
||||||
|
return 21;
|
||||||
|
case 0x51408:
|
||||||
|
return 20;
|
||||||
|
case 0x51308:
|
||||||
|
return 19;
|
||||||
|
case 0x51208:
|
||||||
|
return 18;
|
||||||
|
case 0x51108:
|
||||||
|
return 17;
|
||||||
|
case 0x50F08:
|
||||||
|
return 16;
|
||||||
|
case 0x50E08:
|
||||||
|
return 15;
|
||||||
|
case 0x50D08:
|
||||||
|
return 14;
|
||||||
|
case 0x50C08:
|
||||||
|
return 13;
|
||||||
|
case 0x50B08:
|
||||||
|
return 12;
|
||||||
|
case 0x50A08:
|
||||||
|
return 11;
|
||||||
|
case 0x50908:
|
||||||
|
return 10;
|
||||||
|
case 0x50808:
|
||||||
|
return 9;
|
||||||
|
case 0x50708:
|
||||||
|
return 8;
|
||||||
|
case 0x50608:
|
||||||
|
return 7;
|
||||||
|
case 0x50508:
|
||||||
|
return 6;
|
||||||
|
case 0x50408:
|
||||||
|
return 5;
|
||||||
|
case 0x50308:
|
||||||
|
return 4;
|
||||||
|
case 0x50208:
|
||||||
|
return 3;
|
||||||
|
case 0x50108:
|
||||||
|
return 2;
|
||||||
|
case 0x50008:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InitialD7::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
void InitialD7::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||||
|
{
|
||||||
|
int ffrubbingwalls = 0;
|
||||||
|
int ffcarcollision = 0;
|
||||||
{
|
{
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
helpers->log("in ID6 Ffbloop");
|
helpers->log("in ID7 Ffbloop");
|
||||||
const int ff = GetTeknoParrotFFB();
|
const int ff = GetTeknoParrotFFB();
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
ffcarcollision = carscollide(ff);
|
||||||
|
ffrubbingwalls = rubbingwalls(ff);
|
||||||
|
|
||||||
if ((ff > 0x4005B) & (ff < 0x40080))
|
if (ff == 0x60000)
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
triggers->Spring(0.8);
|
||||||
double percentForce = (262272 - ff) / 36.0;
|
}
|
||||||
|
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffrubbingwalls / 31.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffcarcollision / 16.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 262199) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
|
{
|
||||||
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (262473 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x40100) & (ff < 0x40125))
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
double percentForce = (ff - 262400) / 36.0;
|
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff >= 390001) && (ff <= 399999))
|
}
|
||||||
{
|
|
||||||
helpers->log("sine1");
|
|
||||||
double percentForce = (ff - 390000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(120, 100, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 380001) && (ff <= 389999))
|
|
||||||
{
|
|
||||||
helpers->log("sine2");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 380000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(130, 120, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 370001) && (ff <= 379999))
|
|
||||||
{
|
|
||||||
helpers->log("sine3");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 370000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(140, 140, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 360001) && (ff <= 369999))
|
|
||||||
{
|
|
||||||
helpers->log("sine4");
|
|
||||||
double percentForce = (ff - 360000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(150, 150, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 350001) && (ff <= 359999))
|
|
||||||
{
|
|
||||||
helpers->log("sine5");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 350000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(160, 160, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 340001) && (ff <= 349999))
|
|
||||||
{
|
|
||||||
helpers->log("sine6");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 340000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(170, 170, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 330001) && (ff <= 339999))
|
|
||||||
{
|
|
||||||
helpers->log("sine7");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 330000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(180, 180, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 327681) && (ff <= 329999))
|
|
||||||
{
|
|
||||||
helpers->log("sine8");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 327680) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(190, 190, percentForce);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,93 +1,185 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "InitialD8.h"
|
#include "InitialD8.h"
|
||||||
|
|
||||||
|
static int carscollide(int ffcollide) {
|
||||||
|
switch (ffcollide) {
|
||||||
|
case 0x50F05:
|
||||||
|
return 16;
|
||||||
|
case 0x50E05:
|
||||||
|
return 15;
|
||||||
|
case 0x50D05:
|
||||||
|
return 14;
|
||||||
|
case 0x50C05:
|
||||||
|
return 13;
|
||||||
|
case 0x50B05:
|
||||||
|
return 12;
|
||||||
|
case 0x50A05:
|
||||||
|
return 11;
|
||||||
|
case 0x50905:
|
||||||
|
return 10;
|
||||||
|
case 0x50805:
|
||||||
|
return 9;
|
||||||
|
case 0x50705:
|
||||||
|
return 8;
|
||||||
|
case 0x50605:
|
||||||
|
return 7;
|
||||||
|
case 0x050505:
|
||||||
|
return 6;
|
||||||
|
case 0x050405:
|
||||||
|
return 5;
|
||||||
|
case 0x050305:
|
||||||
|
return 4;
|
||||||
|
case 0x50205:
|
||||||
|
return 3;
|
||||||
|
case 0x50105:
|
||||||
|
return 2;
|
||||||
|
case 0x50005:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rubbingwalls(int ffwalls) {
|
||||||
|
switch (ffwalls) {
|
||||||
|
case 0x51F08:
|
||||||
|
return 31;
|
||||||
|
case 0x51E08:
|
||||||
|
return 30;
|
||||||
|
case 0x51D08:
|
||||||
|
return 29;
|
||||||
|
case 0x51C08:
|
||||||
|
return 28;
|
||||||
|
case 0x51B08:
|
||||||
|
return 27;
|
||||||
|
case 0x51A08:
|
||||||
|
return 26;
|
||||||
|
case 0x51908:
|
||||||
|
return 25;
|
||||||
|
case 0x51808:
|
||||||
|
return 24;
|
||||||
|
case 0x51708:
|
||||||
|
return 23;
|
||||||
|
case 0x51608:
|
||||||
|
return 22;
|
||||||
|
case 0x51508:
|
||||||
|
return 21;
|
||||||
|
case 0x51408:
|
||||||
|
return 20;
|
||||||
|
case 0x51308:
|
||||||
|
return 19;
|
||||||
|
case 0x51208:
|
||||||
|
return 18;
|
||||||
|
case 0x51108:
|
||||||
|
return 17;
|
||||||
|
case 0x50F08:
|
||||||
|
return 16;
|
||||||
|
case 0x50E08:
|
||||||
|
return 15;
|
||||||
|
case 0x50D08:
|
||||||
|
return 14;
|
||||||
|
case 0x50C08:
|
||||||
|
return 13;
|
||||||
|
case 0x50B08:
|
||||||
|
return 12;
|
||||||
|
case 0x50A08:
|
||||||
|
return 11;
|
||||||
|
case 0x50908:
|
||||||
|
return 10;
|
||||||
|
case 0x50808:
|
||||||
|
return 9;
|
||||||
|
case 0x50708:
|
||||||
|
return 8;
|
||||||
|
case 0x50608:
|
||||||
|
return 7;
|
||||||
|
case 0x50508:
|
||||||
|
return 6;
|
||||||
|
case 0x50408:
|
||||||
|
return 5;
|
||||||
|
case 0x50308:
|
||||||
|
return 4;
|
||||||
|
case 0x50208:
|
||||||
|
return 3;
|
||||||
|
case 0x50108:
|
||||||
|
return 2;
|
||||||
|
case 0x50008:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InitialD8::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
void InitialD8::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||||
|
{
|
||||||
|
int ffrubbingwalls = 0;
|
||||||
|
int ffcarcollision = 0;
|
||||||
{
|
{
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename);
|
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
helpers->log("in ID6 Ffbloop");
|
helpers->log("in ID8 Ffbloop");
|
||||||
const int ff = GetTeknoParrotFFB();
|
const int ff = GetTeknoParrotFFB();
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
helpers->log((char *)ffs.c_str());
|
helpers->log((char *)ffs.c_str());
|
||||||
|
ffcarcollision = carscollide(ff);
|
||||||
|
ffrubbingwalls = rubbingwalls(ff);
|
||||||
|
|
||||||
if ((ff > 0x4005B) & (ff < 0x40080))
|
if (ff == 0x60000)
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel right");
|
triggers->Spring(0.8);
|
||||||
double percentForce = (262272 - ff) / 36.0;
|
}
|
||||||
|
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffrubbingwalls / 31.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||||
|
{
|
||||||
|
double percentLength = 200;
|
||||||
|
double percentForce = (ffcarcollision / 16.0);
|
||||||
|
triggers->Inertia(percentForce);
|
||||||
|
triggers->Friction(percentForce);
|
||||||
|
triggers->Damper(percentForce);
|
||||||
|
triggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
if (FFBMode == 1)
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (ff - 262199) / 72.0;
|
||||||
|
triggers->LeftRight(pow(percentForce, powforce), 0, percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
|
{
|
||||||
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
double powforce = (262473 - ff) / 72.0;
|
||||||
|
triggers->LeftRight(0, pow(percentForce, powforce), percentLength);
|
||||||
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((ff > 0x40037) & (ff < 0x40080))
|
||||||
|
{
|
||||||
|
double percentForce = (262272 - ff) / 72.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
triggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff > 0x40100) & (ff < 0x40125))
|
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||||
{
|
{
|
||||||
helpers->log("moving wheel left");
|
double percentForce = (ff - 262400) / 72.0;
|
||||||
double percentForce = (ff - 262400) / 36.0;
|
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
triggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff >= 390001) && (ff <= 399999))
|
}
|
||||||
{
|
|
||||||
helpers->log("sine1");
|
|
||||||
double percentForce = (ff - 390000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(120, 100, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 380001) && (ff <= 389999))
|
|
||||||
{
|
|
||||||
helpers->log("sine2");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 380000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(130, 120, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 370001) && (ff <= 379999))
|
|
||||||
{
|
|
||||||
helpers->log("sine3");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 370000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(140, 140, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 360001) && (ff <= 369999))
|
|
||||||
{
|
|
||||||
helpers->log("sine4");
|
|
||||||
double percentForce = (ff - 360000) / ((SineDivision) / 1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(150, 150, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 350001) && (ff <= 359999))
|
|
||||||
{
|
|
||||||
helpers->log("sine5");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 350000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(160, 160, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 340001) && (ff <= 349999))
|
|
||||||
{
|
|
||||||
helpers->log("sine6");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 340000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(170, 170, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 330001) && (ff <= 339999))
|
|
||||||
{
|
|
||||||
helpers->log("sine7");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 330000) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(180, 180, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff >= 327681) && (ff <= 329999))
|
|
||||||
{
|
|
||||||
helpers->log("sine8");
|
|
||||||
double percentLength = 100;
|
|
||||||
double percentForce = (ff - 327680) / ((SineDivision) / 1.0);
|
|
||||||
triggers->Rumble(percentForce, percentLength);
|
|
||||||
triggers->Sine(190, 190, percentForce);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,44 +30,6 @@ void Machstorm::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrig
|
|||||||
int vibration = helpers->ReadInt32(0x6390E9, /* relative */ true);
|
int vibration = helpers->ReadInt32(0x6390E9, /* relative */ true);
|
||||||
int power = helpers->ReadInt32(0x639109, /* relative */ true);
|
int power = helpers->ReadInt32(0x639109, /* relative */ true);
|
||||||
|
|
||||||
/*if (DomeFix == 1)
|
|
||||||
{
|
|
||||||
U16 *buffer = new U16[1920 * 1080 * 2];
|
|
||||||
|
|
||||||
for (int y = 0; y < 1080; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < 1920; x++)
|
|
||||||
{
|
|
||||||
float d = 0.5f;
|
|
||||||
float xf = x / 1920.0f;
|
|
||||||
float yf = y / 1080.0f;
|
|
||||||
xf = 2.0f * xf - 1.0f;
|
|
||||||
yf = 2.0f * yf - 1.0f;
|
|
||||||
if (0.0f > xf)
|
|
||||||
{
|
|
||||||
float k = 0.95f * -xf / (-xf + d);
|
|
||||||
xf = -k;
|
|
||||||
yf = yf * (1.0f - k);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float k = 0.95f * xf / (xf + d);
|
|
||||||
xf = k;
|
|
||||||
yf = yf * (1.0f - k);
|
|
||||||
}
|
|
||||||
xf = 0.5f * xf + 0.5f;
|
|
||||||
yf = -0.5f * yf - 0.5f;
|
|
||||||
buffer[(y * 1920 + x) * 2] = 65535 * xf;
|
|
||||||
buffer[(y * 1920 + x) * 2 + 1] = 65535 * yf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
helpers->WriteByte<U8>(0x003D2FEE, 0x45, true);
|
|
||||||
helpers->WriteByte<U8>(0x003D3637, 0xB8, true);
|
|
||||||
helpers->WriteIntPtr<U32>(0x003D3638, (U16)buffer, true);
|
|
||||||
helpers->WriteIntPtr<U32>(0x003D363C, 0x0C244489, true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (vibration == 16842753)
|
if (vibration == 16842753)
|
||||||
{
|
{
|
||||||
if (power == 61542)
|
if (power == 61542)
|
||||||
|
@ -1,462 +1,363 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Outrun2Fake.h"
|
#include "Outrun2Fake.h"
|
||||||
|
#include "SDL.h"
|
||||||
|
#include <Windows.h>
|
||||||
|
static EffectTriggers *myTriggers;
|
||||||
|
static EffectConstants *myConstants;
|
||||||
|
static Helpers *myHelpers;
|
||||||
|
static SDL_Event e;
|
||||||
|
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
|
static int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||||
|
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||||
|
static int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
||||||
|
static int Gear1 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear1"), 0, settingsFilename);
|
||||||
|
static int Gear2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear2"), 0, settingsFilename);
|
||||||
|
static int Gear3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear3"), 0, settingsFilename);
|
||||||
|
static int Gear4 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear4"), 0, settingsFilename);
|
||||||
|
static int Gear5 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear5"), 0, settingsFilename);
|
||||||
|
static int Gear6 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear6"), 0, settingsFilename);
|
||||||
|
static int SpeedStrength;
|
||||||
|
|
||||||
void OutRun2Fake::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
static int RunningThread(void *ptr)
|
||||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
{
|
||||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
int cnt;
|
||||||
int ff = helpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
for (cnt = 0; cnt >= 0; ++cnt)
|
||||||
int ffwall = helpers->ReadInt32(0x08273FAC, /* isRelativeOffset */ false);
|
{
|
||||||
float ffspeed = helpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||||
int ff3 = helpers->ReadInt32(0x0827A1DA, /* isRelativeOffset */ false);
|
int ffwall = myHelpers->ReadInt32(0x08273FAC, /* isRelativeOffset */ false);
|
||||||
int ff4 = helpers->ReadInt32(0x0827A35D, /* isRelativeOffset */ false);
|
int ff3 = myHelpers->ReadInt32(0x0827A1DA, /* isRelativeOffset */ false);
|
||||||
int ff5 = helpers->ReadInt32(0x0827A1D4, /* isRelativeOffset */ false);
|
int ff4 = myHelpers->ReadInt32(0x0827A35D, /* isRelativeOffset */ false);
|
||||||
UINT8 ff6 = helpers->ReadByte(0x08670DC8, /* isRelativeOffset */ false); // steering
|
int ff5 = myHelpers->ReadInt32(0x0827A1D4, /* isRelativeOffset */ false);
|
||||||
float ff7 = helpers->ReadFloat32(0x08273AD4, /* isRelativeOffset */ false);
|
UINT8 ff6 = myHelpers->ReadByte(0x08670DC8, /* isRelativeOffset */ false); // steering
|
||||||
UINT8 ff8 = helpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
float ff7 = myHelpers->ReadFloat32(0x08273AD4, /* isRelativeOffset */ false);
|
||||||
UINT8 ff9 = helpers->ReadByte(0x086749CA, /* isRelativeOffset */ false); // 1 when menu
|
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||||
|
UINT8 ff9 = myHelpers->ReadByte(0x086749CA, /* isRelativeOffset */ false); // 1 when menu
|
||||||
helpers->log("got value: ");
|
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||||
std::string ffs = std::to_string(ff);
|
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||||
helpers->log((char *)ffs.c_str());
|
UINT8 static oldgear = 0;
|
||||||
|
|
||||||
int static oldFloat = 0.0;
|
int static oldFloat = 0.0;
|
||||||
int newFloat = ff3;
|
int newFloat = ff3;
|
||||||
int static oldFloat1 = 0.0;
|
int static oldFloat1 = 0.0;
|
||||||
int newFloat1 = ff4;
|
int newFloat1 = ff4;
|
||||||
|
float newgear = gear;
|
||||||
|
|
||||||
|
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||||
|
{
|
||||||
|
SpeedStrength = 10;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||||
|
{
|
||||||
|
SpeedStrength = 20;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||||
|
{
|
||||||
|
SpeedStrength = 30;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||||
|
{
|
||||||
|
SpeedStrength = 40;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||||
|
{
|
||||||
|
SpeedStrength = 50;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||||
|
{
|
||||||
|
SpeedStrength = 60;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||||
|
{
|
||||||
|
SpeedStrength = 70;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||||
|
{
|
||||||
|
SpeedStrength = 80;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||||
|
{
|
||||||
|
SpeedStrength = 90;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||||
|
{
|
||||||
|
SpeedStrength = 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpeedStrength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (FFBMode == 1)
|
if (FFBMode == 1)
|
||||||
{
|
{
|
||||||
if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff8 == 1))
|
if (ff8 == 1)
|
||||||
|
{
|
||||||
|
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||||
{
|
{
|
||||||
double percentForce = ((127 - ff6) / 127.0);
|
double percentForce = ((127 - ff6) / 127.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
myTriggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff8 == 1))
|
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||||
{
|
{
|
||||||
double percentForce = ((ff6 - 127) / 128.0);
|
double percentForce = ((ff6 - 127) / 128.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
myTriggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff9 == 1))
|
}
|
||||||
|
if (ff9 == 1)
|
||||||
|
{
|
||||||
|
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||||
{
|
{
|
||||||
double percentForce = ((127 - ff6) / 127.0);
|
double percentForce = ((127 - ff6) / 127.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
myTriggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff9 == 1))
|
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||||
{
|
{
|
||||||
double percentForce = ((ff6 - 127) / 128.0);
|
double percentForce = ((ff6 - 127) / 128.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
myTriggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.1);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 2))
|
if (ff5 == 2)
|
||||||
{
|
{
|
||||||
double percentForce = (0.2);
|
if (oldFloat != newFloat)
|
||||||
|
{
|
||||||
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
myTriggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 2))
|
else if (ff5 == 1)
|
||||||
{
|
{
|
||||||
double percentForce = (0.4);
|
if (oldFloat != newFloat)
|
||||||
|
{
|
||||||
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
myTriggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.8);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.1);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.2);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.4);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.8);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff8 == 1) & (FFBMode == 0))
|
if (ff8 == 1)
|
||||||
|
{
|
||||||
|
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||||
{
|
{
|
||||||
double percentForce = ((127 - ff6) / 127.0);
|
double percentForce = ((127 - ff6) / 127.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff8 == 1))
|
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||||
{
|
{
|
||||||
double percentForce = ((ff6 - 127) / 128.0);
|
double percentForce = ((ff6 - 127) / 128.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff9 == 1))
|
}
|
||||||
|
if (ff9 == 1)
|
||||||
|
{
|
||||||
|
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||||
{
|
{
|
||||||
double percentForce = ((127 - ff6) / 127.0);
|
double percentForce = ((127 - ff6) / 127.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff9 == 1))
|
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||||
{
|
{
|
||||||
double percentForce = ((ff6 - 127) / 128.0);
|
double percentForce = ((ff6 - 127) / 128.0);
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 2))
|
}
|
||||||
|
if (ff5 == 2)
|
||||||
{
|
{
|
||||||
double percentForce = (0.1);
|
if (oldFloat != newFloat)
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 2))
|
|
||||||
{
|
{
|
||||||
double percentForce = (0.2);
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 2))
|
}
|
||||||
|
else if (ff5 == 1)
|
||||||
{
|
{
|
||||||
double percentForce = (0.3);
|
if (oldFloat != newFloat)
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 2))
|
|
||||||
{
|
{
|
||||||
double percentForce = (0.4);
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 2))
|
}
|
||||||
|
}
|
||||||
|
if (oldFloat1 != newFloat1)
|
||||||
{
|
{
|
||||||
double percentForce = (0.5);
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Sine(200, 200, percentForce);
|
||||||
}
|
}
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 2))
|
else if (ff == 8)
|
||||||
{
|
{
|
||||||
double percentForce = (0.6);
|
if (SpeedStrength > 0)
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.8);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 2))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(0, percentForce, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.1);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.2);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.4);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.8);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 1))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, 0, percentLength);
|
|
||||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((oldFloat1 != newFloat1) & (ffspeed >= 0.1) & (ffspeed <= 50))
|
|
||||||
{
|
|
||||||
double percentForce = (0.1);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 50.1) & (ffspeed <= 100))
|
|
||||||
{
|
|
||||||
double percentForce = (0.2);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 100.1) & (ffspeed <= 150))
|
|
||||||
{
|
|
||||||
double percentForce = (0.3);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 150.1) & (ffspeed <= 200))
|
|
||||||
{
|
|
||||||
double percentForce = (0.4);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 200.1) & (ffspeed <= 250))
|
|
||||||
{
|
|
||||||
double percentForce = (0.5);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 250.1) & (ffspeed <= 300))
|
|
||||||
{
|
|
||||||
double percentForce = (0.6);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 300.1) & (ffspeed <= 350))
|
|
||||||
{
|
|
||||||
double percentForce = (0.7);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 350.1) & (ffspeed <= 400))
|
|
||||||
{
|
|
||||||
double percentForce = (0.8);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 450.1) & (ffspeed <= 500))
|
|
||||||
{
|
|
||||||
double percentForce = (0.9);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((oldFloat1 != newFloat1) & (ffspeed >= 500.1) & (ffspeed <= 1000))
|
|
||||||
{
|
|
||||||
double percentForce = (1.0);
|
|
||||||
double percentLength = 100;
|
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
|
||||||
triggers->Sine(200, 200, percentForce);
|
|
||||||
}
|
|
||||||
else if ((ff == 8) & (ffspeed >= 0.1) & (ffspeed <= 1000))
|
|
||||||
{
|
{
|
||||||
double percentForce = 0.1;
|
double percentForce = 0.1;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
triggers->Sine(70, 70, percentForce);
|
myTriggers->Sine(70, 70, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff == 4) & (ffspeed >= 0.1) & (ffspeed <= 1000))
|
}
|
||||||
|
else if (ff == 4)
|
||||||
|
{
|
||||||
|
if (SpeedStrength > 0)
|
||||||
{
|
{
|
||||||
double percentForce = 0.2;
|
double percentForce = 0.2;
|
||||||
double percentLength = 50;
|
double percentLength = 50;
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
triggers->Sine(50, 50, percentForce);
|
myTriggers->Sine(50, 50, percentForce);
|
||||||
}
|
}
|
||||||
else if ((ff == 16) & (ffspeed >= 0.1) & (ffspeed <= 1000))
|
}
|
||||||
|
else if (ff == 16)
|
||||||
|
{
|
||||||
|
if (SpeedStrength > 0)
|
||||||
{
|
{
|
||||||
double percentForce = 0.2;
|
double percentForce = 0.2;
|
||||||
double percentLength = 50;
|
double percentLength = 50;
|
||||||
triggers->LeftRight(percentForce, percentForce, percentLength);
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
triggers->Sine(100, 50, percentForce);
|
myTriggers->Sine(100, 50, percentForce);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
oldFloat = newFloat;
|
oldFloat = newFloat;
|
||||||
oldFloat1 = newFloat1;
|
oldFloat1 = newFloat1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void OutRun2Fake::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
SDL_Thread *thread;
|
||||||
|
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||||
|
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||||
|
helpers->log("got value: ");
|
||||||
|
std::string ffs = std::to_string(ff);
|
||||||
|
helpers->log((char *)ffs.c_str());
|
||||||
|
|
||||||
|
while (SDL_WaitEvent(&e) != 0)
|
||||||
|
{
|
||||||
|
UINT8 transmission = helpers->ReadByte(0x082932C2, /* isRelativeOffset */ false); // Auto or Manual
|
||||||
|
myTriggers = triggers;
|
||||||
|
myConstants = constants;
|
||||||
|
myHelpers = helpers;
|
||||||
|
if (ShowButtonNumbersForSetup == 1)
|
||||||
|
{
|
||||||
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if (e.jbutton.button == 0)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 0 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 1)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 1 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 2)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 2 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 3)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 3 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 4)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 4 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 5)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 5 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 6)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 6 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 7)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 7 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 8)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 8 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 9)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 9 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 10)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 10 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 11)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 11 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 12)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 12 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 13)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 13 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 14)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 14 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 15)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if (ChangeGearsViaPlugin == 1)
|
||||||
|
{
|
||||||
|
if ((ChangeGearsViaPlugin == 1) && (transmission == 1))
|
||||||
|
{
|
||||||
|
if (e.jbutton.button == Gear1)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x01, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear2)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x02, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear3)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x03, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear4)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x04, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear5)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x05, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear6)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x06, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,62 +1,266 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Outrun2Real.h"
|
#include "Outrun2Real.h"
|
||||||
EffectTriggers* myTriggers;
|
#include "SDL.h"
|
||||||
EffectConstants *myConstants;
|
#include <Windows.h>
|
||||||
Helpers *myHelpers;
|
static EffectTriggers *myTriggers;
|
||||||
|
static EffectConstants *myConstants;
|
||||||
|
static Helpers *myHelpers;
|
||||||
|
static SDL_Event e;
|
||||||
|
static int SpeedStrength;
|
||||||
|
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||||
|
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||||
|
static int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
||||||
|
static int Gear1 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear1"), 0, settingsFilename);
|
||||||
|
static int Gear2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear2"), 0, settingsFilename);
|
||||||
|
static int Gear3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear3"), 0, settingsFilename);
|
||||||
|
static int Gear4 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear4"), 0, settingsFilename);
|
||||||
|
static int Gear5 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear5"), 0, settingsFilename);
|
||||||
|
static int Gear6 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear6"), 0, settingsFilename);
|
||||||
|
|
||||||
|
//B hitting right wall hard constant
|
||||||
|
//1B hitting left wall hard constant
|
||||||
|
//2 driving on grass sine
|
||||||
|
//10 scraping car against side rail left side
|
||||||
|
//4 driving from grass, sand to road if from right side
|
||||||
|
//14 driving from grass, sand to road if from left side
|
||||||
|
//00 when over grass, sand etc
|
||||||
|
|
||||||
void SendForceFeedback(__int8 force)
|
void SendForceFeedback(__int8 force)
|
||||||
{
|
{
|
||||||
if (force >= 1 && force <= 0x0F)
|
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||||
|
/*char gay[256];
|
||||||
|
memset(gay, 0, 256);
|
||||||
|
sprintf(gay, "hex print: %08X", force);
|
||||||
|
OutputDebugStringA(gay);*/
|
||||||
|
if ((force == 0x10) || (force == 0x0B) || (force == 0x04))
|
||||||
{
|
{
|
||||||
// direction from right => makes wheel turn left
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentForce = (16 - force) / 15.0;
|
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
//myHelpers->log("got value: ");
|
|
||||||
//std::string ffs = std::to_string(force);
|
|
||||||
//myHelpers->log((char *)ffs.c_str());
|
|
||||||
myTriggers->LeftRight(0, percentForce, percentLength);
|
myTriggers->LeftRight(0, percentForce, percentLength);
|
||||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||||
}
|
}
|
||||||
else if (force >= 0x10 && force <= 0x1E)
|
if ((force == 0x00) || (force == 0x1B) || (force == 0x14))
|
||||||
{
|
{
|
||||||
// direction from left => makes wheel turn right
|
double percentForce = SpeedStrength / 100.0;
|
||||||
double percentForce = (31 - force) / 15.0;
|
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
//myHelpers->log("got value: ");
|
|
||||||
//std::string ffs = std::to_string(force);
|
|
||||||
//myHelpers->log((char *)ffs.c_str());
|
|
||||||
myTriggers->LeftRight(percentForce, 0, percentLength);
|
myTriggers->LeftRight(percentForce, 0, percentLength);
|
||||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||||
}
|
}
|
||||||
|
if (force == 0x02)
|
||||||
|
{
|
||||||
|
double percentForce = SpeedStrength / 100.0;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
myTriggers->Sine(70, 80, percentForce);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signed int cdecl or2FfbFunction(unsigned __int8 unk1, unsigned __int8 unk2, unsigned __int8 force, char unk3)
|
signed int cdecl or2FfbFunction(unsigned __int8 unk1, unsigned __int8 unk2, unsigned __int8 force, char unk3)
|
||||||
{
|
{
|
||||||
|
int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, TEXT(".\\FFBPlugin.ini"));
|
||||||
if (unk1 == 0x7D)
|
if (unk1 == 0x7D)
|
||||||
{
|
{
|
||||||
// not used afaik
|
//not used
|
||||||
}
|
}
|
||||||
if (unk1 == 0x7B)
|
if (unk1 == 0x7B)
|
||||||
{
|
{
|
||||||
SendForceFeedback(force);
|
SendForceFeedback(force);
|
||||||
}
|
}
|
||||||
|
else if (unk1 != 0x7B)
|
||||||
|
{
|
||||||
|
double percentForce = SpringStrength / 100.0;
|
||||||
|
myTriggers->Springi(percentForce);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int RunningThread(void *ptr)
|
||||||
|
{
|
||||||
|
int cnt;
|
||||||
|
for (cnt = 0; cnt >= 0; ++cnt)
|
||||||
|
{
|
||||||
|
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||||
|
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||||
|
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||||
|
UINT8 static oldgear = 0;
|
||||||
|
float newgear = gear;
|
||||||
|
|
||||||
|
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||||
|
{
|
||||||
|
SpeedStrength = 10;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||||
|
{
|
||||||
|
SpeedStrength = 20;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||||
|
{
|
||||||
|
SpeedStrength = 30;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||||
|
{
|
||||||
|
SpeedStrength = 40;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||||
|
{
|
||||||
|
SpeedStrength = 50;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||||
|
{
|
||||||
|
SpeedStrength = 60;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||||
|
{
|
||||||
|
SpeedStrength = 70;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||||
|
{
|
||||||
|
SpeedStrength = 80;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||||
|
{
|
||||||
|
SpeedStrength = 90;
|
||||||
|
}
|
||||||
|
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||||
|
{
|
||||||
|
SpeedStrength = 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpeedStrength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((oldgear != newgear) && (ff8 == 1) && (ffspeed >= 0.1))
|
||||||
|
{
|
||||||
|
double percentForce = 0.1;
|
||||||
|
double percentLength = 100;
|
||||||
|
myTriggers->Sine(240, 320, percentForce);
|
||||||
|
myTriggers->LeftRight(percentForce, percentForce, percentLength);
|
||||||
|
}
|
||||||
|
oldgear = newgear;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutRun2Real::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void OutRun2Real::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
bool init = false;
|
SDL_Thread *thread;
|
||||||
if (!init)
|
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||||
|
|
||||||
|
while (SDL_WaitEvent(&e) != 0)
|
||||||
|
{
|
||||||
|
bool init = true;
|
||||||
|
if (init)
|
||||||
{
|
{
|
||||||
DWORD tempdw = 0x08105A48;
|
DWORD tempdw = 0x08105A48;
|
||||||
DWORD cock = (DWORD)(void *)or2FfbFunction;
|
DWORD loadffb = (DWORD)(void *)or2FfbFunction;
|
||||||
DWORD tempdw2 = cock - tempdw - 5;
|
DWORD tempdw2 = loadffb - tempdw - 5;
|
||||||
*(BYTE *)tempdw = 0xE9;
|
*(BYTE *)tempdw = 0xE9;
|
||||||
*(DWORD *)(tempdw + 1) = tempdw2;
|
*(DWORD *)(tempdw + 1) = tempdw2;
|
||||||
init = true;
|
init = false;
|
||||||
}
|
}
|
||||||
|
UINT8 transmission = helpers->ReadByte(0x082932C2, /* isRelativeOffset */ false); // Auto or Manual
|
||||||
myTriggers = triggers;
|
myTriggers = triggers;
|
||||||
myConstants = constants;
|
myConstants = constants;
|
||||||
myHelpers = helpers;
|
myHelpers = helpers;
|
||||||
|
if (ShowButtonNumbersForSetup == 1)
|
||||||
|
{
|
||||||
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if (e.jbutton.button == 0)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 0 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 1)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 1 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 2)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 2 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 3)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 3 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 4)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 4 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 5)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 5 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 6)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 6 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 7)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 7 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 8)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 8 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 9)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 9 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 10)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 10 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 11)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 11 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 12)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 12 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 13)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 13 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 14)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 14 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == 15)
|
||||||
|
{
|
||||||
|
MessageBoxA(NULL, "Button 15 Pressed", "", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.type == SDL_JOYBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if ((ChangeGearsViaPlugin == 1) && (transmission == 1))
|
||||||
|
{
|
||||||
|
if (e.jbutton.button == Gear1)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x01, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear2)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x02, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear3)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x03, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear4)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x04, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear5)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x05, false);
|
||||||
|
}
|
||||||
|
else if (e.jbutton.button == Gear6)
|
||||||
|
{
|
||||||
|
helpers->WriteByte(0x0827A160, 0x06, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
//Centering
|
//Centering
|
||||||
double percentForce = (200 - ff ) / 8.0;
|
double percentForce = (200 - ff ) / 8.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->Spring(percentForce);
|
triggers->Spring(pow(percentForce, 0.1));
|
||||||
}
|
}
|
||||||
else if ((ff > 0xB7) & (ff < 0xC0))
|
else if ((ff > 0xB7) & (ff < 0xC0))
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ void SegaRacingClassic::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
|||||||
//Centering
|
//Centering
|
||||||
double percentForce = (200 - ff) / 8.0;
|
double percentForce = (200 - ff) / 8.0;
|
||||||
double percentLength = 100;
|
double percentLength = 100;
|
||||||
triggers->Spring(pow(percentForce, 0.5));
|
triggers->Spring(pow(percentForce, 0.1));
|
||||||
}
|
}
|
||||||
else if ((ff > 0xB7) & (ff < 0xC0))
|
else if ((ff > 0xB7) & (ff < 0xC0))
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,27 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "SegaRally3.h"
|
#include "SegaRally3.h"
|
||||||
|
|
||||||
|
static int __stdcall Out32(DWORD device, DWORD data)
|
||||||
|
{
|
||||||
|
/*static char test[256];
|
||||||
|
memset(test, 0, 256);
|
||||||
|
sprintf(test, "hex print: %08X", data);
|
||||||
|
OutputDebugStringA(test);
|
||||||
|
return 0;*/
|
||||||
|
}
|
||||||
|
|
||||||
void SegaRally3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
void SegaRally3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||||
|
/*bool init = false;
|
||||||
|
HMODULE hMod = GetModuleHandleA("inpout32.dll");
|
||||||
|
if (hMod)
|
||||||
|
{
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
//injector::MakeJMP((DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Inp32"), Inp32);
|
||||||
|
injector::MakeJMP((DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32"), Out32);
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
helpers->log("in SR3 Ffbloop");
|
helpers->log("in SR3 Ffbloop");
|
||||||
const int ff = GetTeknoParrotFFB();
|
const int ff = GetTeknoParrotFFB();
|
||||||
std::string ffs = std::to_string(ff);
|
std::string ffs = std::to_string(ff);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "TestGame.h"
|
#include "TestGame.h"
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
//settingsFN copied from DllMain.cpp; renamed from settingsFilename
|
//settingsFN copied from DllMain.cpp; renamed from settingsFilename
|
||||||
wchar_t *settingsFN = TEXT(".\\FFBPlugin.ini");
|
wchar_t *settingsFN = TEXT(".\\FFBPlugin.ini");
|
||||||
@ -36,5 +37,8 @@ void TestGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
|||||||
triggers->Friction(0);
|
triggers->Friction(0);
|
||||||
triggers->Spring(0);
|
triggers->Spring(0);
|
||||||
break;
|
break;
|
||||||
|
case -7:
|
||||||
|
triggers->LeftRight(1.0, 1.0, SDL_HAPTIC_INFINITY);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -80,10 +80,20 @@ HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Escape(LPDIEFFESCAPE pesc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
|
HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetCapabilities(LPDIDEVCAPS lpDIDevCaps)
|
||||||
|
{
|
||||||
|
wchar_t *settingsFilenameA = TEXT(".\\FFBPlugin.ini");
|
||||||
|
int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFilenameA);
|
||||||
|
if (configGameId == 29)
|
||||||
|
{
|
||||||
|
if (pDeviceA) return pDeviceA->GetCapabilities(NULL);
|
||||||
|
return pDeviceW->GetCapabilities(lpDIDevCaps);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (pDeviceA) return pDeviceA->GetCapabilities(lpDIDevCaps);
|
if (pDeviceA) return pDeviceA->GetCapabilities(lpDIDevCaps);
|
||||||
return pDeviceW->GetCapabilities(lpDIDevCaps);
|
return pDeviceW->GetCapabilities(lpDIDevCaps);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
|
HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,66 @@
|
|||||||
***FFB Arcade Plugin***
|
***FFB Arcade Plugin***
|
||||||
|
|
||||||
Version 0.8
|
Version 0.9
|
||||||
|
|
||||||
Created by Boomslangnz, Ducon2016 & Spazzy.
|
Created by Boomslangnz, Ducon2016 & Spazzy.
|
||||||
|
|
||||||
This is a plugin to provide Force Feedback and Rumble (and in certain cases added input support) to various arcade games. Initially this was a small project
|
This is a plugin to provide Force Feedback and Rumble (and in certain cases added input support) to various arcade games. Initially this was a small project
|
||||||
to add FFB to Daytona Championship USA and it grew from there to support several more games and rumble was added.
|
to add FFB to Daytona Championship USA and it grew from there to support several more games and rumble was added.
|
||||||
While best efforts were made to try to resemble the real arcade force feedback, It will never be 100% accurate &
|
While best efforts were made to try to resemble the real arcade force feedback, It will never be 100% accurate &
|
||||||
in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4. Effects were created entirely from scratch
|
in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4,effects were created entirely from scratch
|
||||||
so are not using any real force feedback values
|
so are not using real force feedback values. Most games use correct ffb values however :)
|
||||||
|
|
||||||
|
***0.9 Changes***
|
||||||
|
|
||||||
|
- Added scroll bar to MKDX and Road Fighters 3D input side as couldn't see all options unless very high resolution monitor on GUI
|
||||||
|
|
||||||
|
- Completely Modified OR2 SP Real plugin as effects were set quite wrong previously & added gear shift rumble as requested
|
||||||
|
|
||||||
|
- Added optional input support for OR2 SP for H-Pattern gear changes (will only work if you select manual transmission)
|
||||||
|
|
||||||
|
- Fixed issue which would cause Force Feedback to not work on Road Fighters 3D due to dinput8 blocker i was using previously on certain wheels.
|
||||||
|
PLEASE REMOVE d3d9.dll & dinput8.dll if used old version!!!
|
||||||
|
Blocker is not necessary anymore and ive fixed it properly compared to being lazy lol. Enable input support to disable default dinput8 controls used by Road Fighters 3D
|
||||||
|
|
||||||
|
- Modified Road Fighters 3D FFB to only work when racing starts as otherwise it does crazy stuff before race or while attract mode plays
|
||||||
|
|
||||||
|
- Added option to disable 3D for Road Fighters 3D
|
||||||
|
|
||||||
|
- Added option to do a hack to try skip past error menu screen quickly for Road Fighters 3D on startup
|
||||||
|
|
||||||
|
- Added option to close Libmovie error popup automatically if it happens for Road Fighters 3D
|
||||||
|
|
||||||
|
- Lowered default Max Force for WMMT5 since people never read readme, then complain it's too strong
|
||||||
|
|
||||||
|
- Huge overhaul for when adding inputs to input supported games via gui, Works much better (Click on axis/button number on right side to remove if required)
|
||||||
|
|
||||||
|
- Re-wrote input system for every supported game via plugin itself
|
||||||
|
|
||||||
|
- Fixed various bugs found in GUI
|
||||||
|
|
||||||
|
- Renamed Input Setup in FFBPluginGUI.exe to Input / Miscellaneous Setup as it has options other then JUST input on certain games
|
||||||
|
|
||||||
|
- Added Force Feedback test page to GUI for users to test effects on their devices
|
||||||
|
|
||||||
|
- Fixed issue where Feedback Length wouldn't allow enough characters and modify ini setting automatically
|
||||||
|
|
||||||
|
- Defaulted log to off, not as necessary anymore with GUI around
|
||||||
|
|
||||||
|
- Modified Initial D4,D5,D6,D7 & D8 plugin (Be sure to try out both FFBMode and without) Remember to set FORCE=10 in test menu
|
||||||
|
|
||||||
|
- Added support for new haptic effect forces damper, inertia, ramp, sawtoothup, sawtoothdown & triangle
|
||||||
|
|
||||||
|
- Modified Daytona Championship USA exit method for better way
|
||||||
|
|
||||||
|
- Modified forces to avoid the "tick" feeling with certain effects
|
||||||
|
|
||||||
|
- Raised spring strength in Sega Racing Classic plugin
|
||||||
|
|
||||||
|
- Tidied up Battle Gear 4 code and replace simple rumble with left/right effects for rumble
|
||||||
|
|
||||||
|
- Added test code to rumble for infinite time period. Set GameID to -7 if you want to check rumble works via plugin
|
||||||
|
|
||||||
|
- Fixed issue where plugin could crash game if no FFBPlugin.ini was present in game folder
|
||||||
|
|
||||||
***0.8 Changes***
|
***0.8 Changes***
|
||||||
|
|
||||||
@ -166,8 +218,6 @@ extremely generous.
|
|||||||
|
|
||||||
- Mame team
|
- Mame team
|
||||||
|
|
||||||
- Racer_S for making dinput8 blocker used on Road Fighters 3D
|
|
||||||
|
|
||||||
- SailorSat for finding the offsets etc required for Daytona USA Multiplayer AI hack
|
- SailorSat for finding the offsets etc required for Daytona USA Multiplayer AI hack
|
||||||
|
|
||||||
- Nuexzz for finding offset required for Daytona Panoramic Force Hack
|
- Nuexzz for finding offset required for Daytona Panoramic Force Hack
|
||||||
@ -252,7 +302,7 @@ TURN ON FEEDBACK STEERING IN GAME SETTINGS OR YOU WILL NOT RECIEVE FORCE FEEDBAC
|
|||||||
|
|
||||||
-GTI Club Supermini Festa [dinput8.dll into game exe folder]
|
-GTI Club Supermini Festa [dinput8.dll into game exe folder]
|
||||||
|
|
||||||
-Road Fighters 3D [d3d9.dll & dinput8.dll(if using ffb plugin for inputs) into game exe folder]
|
-Road Fighters 3D [dinput8.dll into game exe folder]
|
||||||
|
|
||||||
-Nascar Racing [dinput8.dll into demul 180428 version folder]
|
-Nascar Racing [dinput8.dll into demul 180428 version folder]
|
||||||
|
|
||||||
@ -287,7 +337,7 @@ EnableRumble= **Turn Off (0) if your wheel supports rumble effect. For controlle
|
|||||||
|
|
||||||
Logging= **Turn On (1) to allow log.txt to be made to log plugin. Device GUID is given in here**
|
Logging= **Turn On (1) to allow log.txt to be made to log plugin. Device GUID is given in here**
|
||||||
|
|
||||||
ResetFeedback= **When a command is set that contradicts a prior command, clear the prior command. Should stay as 1**
|
ResetFeedback= **When a command is set that contradicts a prior command, clear the prior command.**
|
||||||
|
|
||||||
FeedbackLength= **Length of a feedback command**
|
FeedbackLength= **Length of a feedback command**
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user