Merge branch 'master' of https://github.com/mightymikem/FFBArcadePlugin
This commit is contained in:
commit
9988c0806a
@ -78,6 +78,14 @@ UINT8 Helpers::WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset)
|
||||
return val;
|
||||
}
|
||||
|
||||
WORD Helpers::WriteWord(INT_PTR offset, WORD val, bool isRelativeOffset)
|
||||
{
|
||||
SIZE_T written;
|
||||
LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset);
|
||||
WriteProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(WORD), &written);
|
||||
return val;
|
||||
}
|
||||
|
||||
INT_PTR Helpers::WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset)
|
||||
{
|
||||
SIZE_T written;
|
||||
@ -123,6 +131,15 @@ INT_PTR Helpers::ReadIntPtr(INT_PTR offset, bool isRelativeOffset)
|
||||
return val;
|
||||
};
|
||||
|
||||
WORD Helpers::ReadWord(INT_PTR offset, bool isRelativeOffset)
|
||||
{
|
||||
SIZE_T read;
|
||||
LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset);
|
||||
WORD val;
|
||||
ReadProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(WORD), &read);
|
||||
return val;
|
||||
};
|
||||
|
||||
long long Helpers::ReadLong(INT_PTR offset, bool isRelativeOffset)
|
||||
{
|
||||
SIZE_T read;
|
||||
|
@ -106,10 +106,12 @@ public:
|
||||
LPVOID GetTranslatedOffset(INT_PTR offset);
|
||||
int ReadInt32(INT_PTR offset, bool isRelativeOffset);
|
||||
UINT8 ReadByte(INT_PTR offset, bool isRelativeOffset);
|
||||
WORD ReadWord(INT_PTR offset, bool isRelativeOffset);
|
||||
float WriteFloat32(INT_PTR offset, float val, bool isRelativeOffset);
|
||||
UINT8 WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset);
|
||||
INT_PTR WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset);
|
||||
UINT8 WriteNop(INT_PTR offset, int countBytes, bool isRelativeOffset);
|
||||
WORD WriteWord(INT_PTR offset, WORD val, bool isRelativeOffset);
|
||||
INT_PTR ReadIntPtr(INT_PTR offset, bool isRelativeOffset);
|
||||
long long ReadLong(INT_PTR offset, bool isRelativeOffset);
|
||||
float ReadFloat32(INT_PTR offset, bool isRelativeOffset);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1573,6 +1573,10 @@ void TriggerSineEffect(UINT16 period, UINT16 fadePeriod, double strength)
|
||||
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastSineEffect)).count();
|
||||
|
||||
int direction = 1;
|
||||
|
||||
if (period < 1)
|
||||
return;
|
||||
|
||||
if (strength < -0.001) {
|
||||
strength *= -1;
|
||||
direction = -1;
|
||||
|
@ -322,6 +322,7 @@ int fasterspeed(int ffspeed) {
|
||||
static int InitialDFFBLoop()
|
||||
{
|
||||
DWORD FFB = myHelpers->ReadInt32(FFBAddress, false);
|
||||
WORD FFBStr = myHelpers->ReadWord(FFBAddress + 0x02, false);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -332,34 +333,34 @@ static int InitialDFFBLoop()
|
||||
myTriggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -22,8 +22,11 @@ extern int EnableDamper;
|
||||
extern int DamperStrength;
|
||||
|
||||
bool init = false;
|
||||
extern int EnableDamper;
|
||||
extern int DamperStrength;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ViosityStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ViosityStrength"), 100, settingsFilename);
|
||||
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename);
|
||||
|
||||
|
||||
static void(__cdecl* clSteerDualDeviceSetTRQCurveHalfPointOrig)(void* thisParam, int param_1, float param_2, float param_3);
|
||||
static void __cdecl clSteerDualDeviceSetTRQCurveHalfPoint(void* thisParam, int param_1, float param_2, float param_3) {
|
||||
@ -39,13 +42,15 @@ static void __cdecl clSteerDualDeviceSetVibrate(void* thisParam, int param_1, fl
|
||||
|
||||
static void(__cdecl* clSteerDualDeviceSetViscosityOrig)(void* thisParam, int param_1, float param_2, float param_3);
|
||||
static void __cdecl clSteerDualDeviceSetViscosity(void* thisParam, int param_1, float param_2, float param_3) {
|
||||
myTriggers->Friction((double)param_2);
|
||||
double percentForce = (double)param_2 * (ViosityStrength / 100.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
return clSteerDualDeviceSetViscosityOrig(thisParam, param_1, param_2, param_3);
|
||||
}
|
||||
|
||||
static void(__cdecl* clSteerDualDeviceInitCenterOrig)(void* thisParam, int param_1, unsigned char param_2);
|
||||
static void __cdecl clSteerDualDeviceInitCenter(void* thisParam, int param_1, unsigned char param_2) {
|
||||
myTriggers->Springi(param_2);
|
||||
double percentForce = (double)param_2 * (SpringStrength / 100.0);
|
||||
myTriggers->Springi(percentForce);
|
||||
return clSteerDualDeviceInitCenterOrig(thisParam, param_1, param_2);
|
||||
}
|
||||
|
||||
@ -71,4 +76,4 @@ void HummerExtreme::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
MH_CreateHook((LPVOID)0x80d0302, clSteerDualDeviceInitCenter, (LPVOID*)&clSteerDualDeviceInitCenterOrig);
|
||||
MH_EnableHook(MH_ALL_HOOKS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ void InitialDTA231::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x3D35838, true);
|
||||
WORD FFBStr = helpers->ReadWord(0x3D3583A, true);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -38,34 +39,34 @@ void InitialDTA231::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -44,6 +44,7 @@ void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x168317C, true);
|
||||
WORD FFBStr = helpers->ReadWord(0x168317E, true);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -52,34 +53,34 @@ void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -44,6 +44,7 @@ void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x18A720C, true);
|
||||
WORD FFBStr = helpers->ReadWord(0x18A720E, true);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -52,34 +53,34 @@ void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -44,6 +44,7 @@ void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x18B54DC, true);
|
||||
WORD FFBStr = helpers->ReadWord(0x18B54DE, true);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -52,41 +53,34 @@ void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -20,6 +20,7 @@ extern int DamperStrength;
|
||||
|
||||
void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
DWORD FFB = helpers->ReadInt32(0x089AE898, false);
|
||||
WORD FFBStr = helpers->ReadWord(0x089AE89A, false);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -28,34 +29,34 @@ void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -24,6 +24,7 @@ void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x08989858, false);
|
||||
WORD FFBStr = helpers->ReadWord(0x0898985A, false);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -32,34 +33,34 @@ void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -24,6 +24,7 @@ void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x8CB6120, false);
|
||||
WORD FFBStr = helpers->ReadWord(0x8CB6122, false);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -32,34 +33,34 @@ void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -23,6 +23,7 @@ void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
DWORD FFB = helpers->ReadInt32(0x7261F4, true);
|
||||
WORD FFBStr = helpers->ReadWord(0x7261F6, true);
|
||||
|
||||
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
|
||||
|
||||
@ -31,34 +32,34 @@ void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 24.0;
|
||||
double Period = ffb[1] / 128.0 * 120.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 24.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 24.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 24.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -22,6 +22,7 @@ static bool Version103;
|
||||
static bool Version230;
|
||||
|
||||
static DWORD FFB;
|
||||
static WORD FFBStr;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
||||
@ -70,10 +71,16 @@ void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
else
|
||||
{
|
||||
if (Version103)
|
||||
{
|
||||
FFB = helpers->ReadInt32(0x8E5CCF4, true);
|
||||
FFBStr = helpers->ReadWord(0x8E5CCF6, true);
|
||||
}
|
||||
|
||||
if (Version230)
|
||||
{
|
||||
FFB = helpers->ReadInt32(0x9BC7B18, true);
|
||||
FFBStr = helpers->ReadWord(0x9BC7B1A, true);
|
||||
}
|
||||
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
@ -85,34 +92,34 @@ void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x85 && ffb[1] > 0x00 && FFBStr > 0x00)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double Period = ffb[1] / 127.0 * 120.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(static_cast<int>(Period), 0, percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x86 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x86 && FFBStr)
|
||||
{
|
||||
double percentForce = ffb[2] / 127.0;
|
||||
double percentForce = FFBStr / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
|
||||
if (ffb[0] == 0x84 && ffb[2] > 0x00)
|
||||
if (ffb[0] == 0x84 && FFBStr > 0x00)
|
||||
{
|
||||
if (ffb[1] == 0x00)
|
||||
{
|
||||
double percentForce = (128 - ffb[2]) / 127.0;
|
||||
double percentForce = (32767.0 - FFBStr) / 32767.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if(ffb[1] == 0x01)
|
||||
else if (ffb[1] == 0x01)
|
||||
{
|
||||
double percentForce = (ffb[2] / 127.0);
|
||||
double percentForce = (FFBStr / 32767.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
|
@ -1 +1 @@
|
||||
v2.0.0.51
|
||||
v2.0.0.52
|
Loading…
Reference in New Issue
Block a user