1
0
mirror of synced 2024-11-23 22:40:57 +01:00

Changes to Initial D FFB etc

This commit is contained in:
Boomslangnz 2024-07-21 10:14:02 +12:00
parent b76672cdd4
commit 13b43fb573
15 changed files with 108 additions and 80 deletions

View File

@ -78,6 +78,14 @@ UINT8 Helpers::WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset)
return val; 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) INT_PTR Helpers::WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset)
{ {
SIZE_T written; SIZE_T written;
@ -123,6 +131,15 @@ INT_PTR Helpers::ReadIntPtr(INT_PTR offset, bool isRelativeOffset)
return val; 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) long long Helpers::ReadLong(INT_PTR offset, bool isRelativeOffset)
{ {
SIZE_T read; SIZE_T read;

View File

@ -106,10 +106,12 @@ public:
LPVOID GetTranslatedOffset(INT_PTR offset); LPVOID GetTranslatedOffset(INT_PTR offset);
int ReadInt32(INT_PTR offset, bool isRelativeOffset); int ReadInt32(INT_PTR offset, bool isRelativeOffset);
UINT8 ReadByte(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); float WriteFloat32(INT_PTR offset, float val, bool isRelativeOffset);
UINT8 WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset); UINT8 WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset);
INT_PTR WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset); INT_PTR WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset);
UINT8 WriteNop(INT_PTR offset, int countBytes, 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); INT_PTR ReadIntPtr(INT_PTR offset, bool isRelativeOffset);
long long ReadLong(INT_PTR offset, bool isRelativeOffset); long long ReadLong(INT_PTR offset, bool isRelativeOffset);
float ReadFloat32(INT_PTR offset, bool isRelativeOffset); float ReadFloat32(INT_PTR offset, bool isRelativeOffset);

Binary file not shown.

Binary file not shown.

View File

@ -322,6 +322,7 @@ int fasterspeed(int ffspeed) {
static int InitialDFFBLoop() static int InitialDFFBLoop()
{ {
DWORD FFB = myHelpers->ReadInt32(FFBAddress, false); DWORD FFB = myHelpers->ReadInt32(FFBAddress, false);
WORD FFBStr = myHelpers->ReadWord(FFBAddress + 0x02, false);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -332,34 +333,34 @@ static int InitialDFFBLoop()
myTriggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
myTriggers->Rumble(percentForce, percentForce, percentLength); myTriggers->Rumble(percentForce, percentForce, percentLength);
myTriggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
myTriggers->Spring(percentForce); myTriggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Rumble(percentForce, 0, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); myTriggers->Constant(myConstants->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; double percentLength = 100;
myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Rumble(0, percentForce, percentLength);
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -30,6 +30,7 @@ void InitialDTA231::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x3D35838, true); DWORD FFB = helpers->ReadInt32(0x3D35838, true);
WORD FFBStr = helpers->ReadWord(0x3D3583A, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -38,34 +39,34 @@ void InitialDTA231::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -44,6 +44,7 @@ void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x168317C, true); DWORD FFB = helpers->ReadInt32(0x168317C, true);
WORD FFBStr = helpers->ReadWord(0x168317E, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -52,34 +53,34 @@ void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -44,6 +44,7 @@ void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x18A720C, true); DWORD FFB = helpers->ReadInt32(0x18A720C, true);
WORD FFBStr = helpers->ReadWord(0x18A720E, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -52,34 +53,34 @@ void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -44,6 +44,7 @@ void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x18B54DC, true); DWORD FFB = helpers->ReadInt32(0x18B54DC, true);
WORD FFBStr = helpers->ReadWord(0x18B54DE, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -52,41 +53,34 @@ void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x86 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{
double percentForce = ffb[2] / 127.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
if (ffb[0] == 0x84 && ffb[2] > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -20,6 +20,7 @@ extern int DamperStrength;
void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
DWORD FFB = helpers->ReadInt32(0x089AE898, false); DWORD FFB = helpers->ReadInt32(0x089AE898, false);
WORD FFBStr = helpers->ReadWord(0x089AE89A, false);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -28,34 +29,34 @@ void InitialD4::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -24,6 +24,7 @@ void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x08989858, false); DWORD FFB = helpers->ReadInt32(0x08989858, false);
WORD FFBStr = helpers->ReadWord(0x0898985A, false);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -32,34 +33,34 @@ void InitialD4Japan::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -24,6 +24,7 @@ void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x8CB6120, false); DWORD FFB = helpers->ReadInt32(0x8CB6120, false);
WORD FFBStr = helpers->ReadWord(0x8CB6122, false);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -32,34 +33,34 @@ void InitialD5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -23,6 +23,7 @@ void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
DWORD FFB = helpers->ReadInt32(0x7261F4, true); DWORD FFB = helpers->ReadInt32(0x7261F4, true);
WORD FFBStr = helpers->ReadWord(0x7261F6, true);
BYTE* ffb = reinterpret_cast<BYTE*>(&FFB); BYTE* ffb = reinterpret_cast<BYTE*>(&FFB);
@ -31,34 +32,34 @@ void KODrive::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
triggers->Spring(1.0); 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 percentForce = FFBStr / 32767.0;
double Period = ffb[1] / 128.0 * 120.0; double Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 24.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
} }
else if (ffb[1] == 0x01) else if (ffb[1] == 0x01)
{ {
double percentForce = (ffb[2] / 24.0); double percentForce = (FFBStr / 32767.0);
double percentLength = 100; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -22,6 +22,7 @@ static bool Version103;
static bool Version230; static bool Version230;
static DWORD FFB; static DWORD FFB;
static WORD FFBStr;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
@ -70,10 +71,16 @@ void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
else else
{ {
if (Version103) if (Version103)
{
FFB = helpers->ReadInt32(0x8E5CCF4, true); FFB = helpers->ReadInt32(0x8E5CCF4, true);
FFBStr = helpers->ReadWord(0x8E5CCF6, true);
}
if (Version230) if (Version230)
{
FFB = helpers->ReadInt32(0x9BC7B18, true); FFB = helpers->ReadInt32(0x9BC7B18, true);
FFBStr = helpers->ReadWord(0x9BC7B1A, true);
}
if (EnableDamper) if (EnableDamper)
triggers->Damper(DamperStrength / 100.0); triggers->Damper(DamperStrength / 100.0);
@ -85,34 +92,34 @@ void SWDC::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
triggers->Spring(1.0); 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 Period = ffb[1] / 127.0 * 120.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength); triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(static_cast<int>(Period), 0, percentForce); 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; double percentLength = 100;
triggers->Spring(percentForce); triggers->Spring(percentForce);
} }
if (ffb[0] == 0x84 && ffb[2] > 0x00) if (ffb[0] == 0x84 && FFBStr > 0x00)
{ {
if (ffb[1] == 0x00) if (ffb[1] == 0x00)
{ {
double percentForce = (128 - ffb[2]) / 127.0; double percentForce = (32767.0 - FFBStr) / 32767.0;
double percentLength = 100; double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength); triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); 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; double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength); triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);

View File

@ -1 +1 @@
v2.0.0.51 v2.0.0.52