Revert2
This commit is contained in:
parent
5eb7b21952
commit
81288aca08
17
Common Files/TeknoParrotGame.cpp
Normal file
17
Common Files/TeknoParrotGame.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "TeknoParrotGame.h"
|
||||
TeknoParrotGame::TeknoParrotGame()
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int *)secData + 2);
|
||||
}
|
||||
|
||||
int TeknoParrotGame::GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int *)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
void TeknoParrotGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
helpers->log("TeknoParrot game not implemented");
|
||||
}
|
18
Common Files/TeknoParrotGame.h
Normal file
18
Common Files/TeknoParrotGame.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "Game.h"
|
||||
|
||||
class TeknoParrotGame : public Game {
|
||||
|
||||
// TP-related
|
||||
HANDLE hSection;
|
||||
LPVOID secData;
|
||||
int ffbOffset = 0;
|
||||
|
||||
protected:
|
||||
int lastWasStop = 0;
|
||||
int GetTeknoParrotFFB();
|
||||
TeknoParrotGame();
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -50,6 +50,7 @@
|
||||
<ClCompile Include="Game Files\KODrive.cpp" />
|
||||
<ClCompile Include="Game Files\OutRun2Real.cpp" />
|
||||
<ClCompile Include="Game Files\ButtonRumble.cpp" />
|
||||
<ClCompile Include="Common Files\TeknoParrotGame.cpp" />
|
||||
<ClCompile Include="Game Files\Demul.cpp" />
|
||||
<ClCompile Include="Game Files\AfterburnerClimax.cpp" />
|
||||
<ClCompile Include="Game Files\BG4JP.cpp" />
|
||||
@ -85,6 +86,7 @@
|
||||
<ClCompile Include="Game Files\LGI3D.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common Files\TeknoParrotGame.h" />
|
||||
<ClInclude Include="Game Files\AfterburnerClimax.h" />
|
||||
<ClInclude Include="Game Files\BG4JP.h" />
|
||||
<ClInclude Include="Game Files\Daytona3.h" />
|
||||
|
@ -47,6 +47,7 @@
|
||||
<ClCompile Include="Game Files\ChaseHQ2.cpp">
|
||||
<Filter>Game Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common Files\TeknoParrotGame.cpp" />
|
||||
<ClCompile Include="Game Files\MarioKartGPDX.cpp">
|
||||
<Filter>Game Files</Filter>
|
||||
</ClCompile>
|
||||
@ -151,6 +152,9 @@
|
||||
<ClInclude Include="Game Files\ChaseHQ2.h">
|
||||
<Filter>Game Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common Files\TeknoParrotGame.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\MarioKartGPDX.h">
|
||||
<Filter>Game Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -14,57 +14,29 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
#include "AfterburnerClimax.h"
|
||||
#include "SDL.h"
|
||||
static SDL_Event e;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
UINT8 ff = helpers->ReadByte(0x08347A5E, /* isRelativeOffset */ false);
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int Rumble1Strength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble1Strength"), 0, settingsFilename);
|
||||
static int Rumble2Strength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble2Strength"), 0, settingsFilename);
|
||||
static int Rumble1Length = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble1Length"), 0, settingsFilename);
|
||||
static int Rumble2Length = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble2Length"), 0, settingsFilename);
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
UINT8 ff = myHelpers->ReadByte(0x08347A5E, /* isRelativeOffset */ false);
|
||||
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int Rumble1Strength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble1Strength"), 0, settingsFilename);
|
||||
int Rumble2Strength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble2Strength"), 0, settingsFilename);
|
||||
int Rumble1Length = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble1Length"), 0, settingsFilename);
|
||||
int Rumble2Length = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rumble2Length"), 0, settingsFilename);
|
||||
|
||||
if (ff == 64)
|
||||
{
|
||||
double percentForce = ((Rumble1Strength) / 100.0);
|
||||
double percentLength = (Rumble1Length);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (ff == 80)
|
||||
{
|
||||
double percentForce = ((Rumble2Strength) / 100.0);
|
||||
double percentLength = (Rumble2Length);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
@ -13,21 +13,12 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "BG4JP.h"
|
||||
#include "SDL.h"
|
||||
static SDL_Event e;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static int SpeedStrength;
|
||||
void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ff = myHelpers->ReadInt32(0x42EBB0, /* isRelativeOffset */ true);
|
||||
float ffspeed = myHelpers->ReadFloat32(0x3F3000, /* isRelativeOffset */ true);
|
||||
float ff2 = myHelpers->ReadFloat32(0x42EAB4, /* isRelativeOffset */ true);
|
||||
int ff = helpers->ReadInt32(0x42EBB0, /* isRelativeOffset */ true);
|
||||
float ffspeed = helpers->ReadFloat32(0x3F3000, /* isRelativeOffset */ true);
|
||||
float ff2 = helpers->ReadFloat32(0x42EAB4, /* isRelativeOffset */ true);
|
||||
if ((ffspeed >= 0.1) & (ffspeed <= 15))
|
||||
{
|
||||
SpeedStrength = 10;
|
||||
@ -69,54 +60,36 @@ static int RunningThread(void* ptr)
|
||||
SpeedStrength = 0;
|
||||
}
|
||||
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if ((2000000 < ff) && (ff < 4000000))
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 150;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((1000000 < ff) && (ff < 1600000))
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 150;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((0.00000000000000000001 < ff2) && (ffspeed > 0.01))
|
||||
{
|
||||
double percentForce = (0.1);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((0.00000000000000000001 > ff2) && (ffspeed > 0.01))
|
||||
{
|
||||
double percentForce = (0.1);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class BG4JP : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -13,15 +13,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "ChaseHQ2.h"
|
||||
#include "SDL.h"
|
||||
static SDL_Event e;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
|
||||
int ttx2chasehq2(int ffRaw) {
|
||||
switch (ffRaw) {
|
||||
|
||||
// moving right, from weakest to strongest (30 => 16).
|
||||
case 28672:
|
||||
return 30;
|
||||
case 24640:
|
||||
@ -53,6 +48,7 @@ int ttx2chasehq2(int ffRaw) {
|
||||
case 30816:
|
||||
return 16;
|
||||
|
||||
// moving left, from weakest to strongest (15 => 1)
|
||||
case 20480:
|
||||
return 15;
|
||||
case 16448:
|
||||
@ -89,16 +85,13 @@ int ttx2chasehq2(int ffRaw) {
|
||||
}
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
void ChaseHQ2::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
int ff = 0;
|
||||
{
|
||||
long ffAddress = myHelpers->ReadInt32(0x130B558, true);
|
||||
int ffRaw = myHelpers->ReadInt32(ffAddress + 0x45, false);
|
||||
int lampArray[8] = { (16384) + 1, 16 ,1024 ,512, 128, 8, 256 };
|
||||
long ffAddress = helpers->ReadInt32(0x130B558, /* isRelativeOffset*/ true);
|
||||
int ffRaw = helpers->ReadInt32(ffAddress + 0x45, /* isRelativeOffset */ false);
|
||||
int lampArray[8] = { (16384) + 1, 16 ,1024 ,512, 128, 8, 256 };//The 1 isn't needed but I wasn't sure how to get the 16384 to see the first digit any other way lol
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if ((ffRaw & lampArray[i]) == lampArray[i]) {
|
||||
ffRaw -= lampArray[i];
|
||||
@ -108,42 +101,37 @@ static int RunningThread(void* ptr)
|
||||
ff = ttx2chasehq2(ffRaw);
|
||||
}
|
||||
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff > 15)
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
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;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
// direction from left => makes wheel turn right
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff
|
||||
lastWasStop = 0;
|
||||
}
|
||||
else if (ff > 0)
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
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;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
// direction from right => makes wheel turn left
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff
|
||||
lastWasStop = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChaseHQ2::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
else
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (lastWasStop == 0) {
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
||||
lastWasStop = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class ChaseHQ2 : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -140,14 +140,8 @@ static int RunningThread(void *ptr)
|
||||
}
|
||||
|
||||
void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
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: ");
|
||||
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class Daytona3 : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -18,12 +18,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include "SDL.h"
|
||||
|
||||
static SDL_Event e;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
|
||||
int nascar(int ffnas) {
|
||||
switch (ffnas) {
|
||||
@ -116,14 +110,11 @@ BOOL CALLBACK FindWindowBySubstr(HWND hwnd, LPARAM substring)
|
||||
return true; // Need to continue enumerating windows
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
void Demul::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
const TCHAR substring[] = TEXT("NASCAR");
|
||||
EnumWindows(FindWindowBySubstr, (LPARAM)substring);
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
|
||||
{
|
||||
@ -131,69 +122,53 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring))
|
||||
{
|
||||
UINT8 ffnas = myHelpers->ReadByte(0x30060C, /* isRelativeOffset */ true); //Nascar Arcade
|
||||
UINT8 ffnas = helpers->ReadByte(0x30060C, /* isRelativeOffset */ true); //Nascar Arcade
|
||||
std::string ffs = std::to_string(ffnas);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log((char *)ffs.c_str());
|
||||
helpers->log("got value: ");
|
||||
ffnascar = nascar(ffnas);
|
||||
|
||||
if (FFBMode == 0)
|
||||
{
|
||||
if ((ffnascar > 16)& (ffnascar < 33))
|
||||
if ((ffnascar > 16) & (ffnascar < 33))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ffnascar - 16) / 16.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ffnascar > 0)& (ffnascar < 17))
|
||||
else if ((ffnascar > 0) & (ffnascar < 17))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (17 - ffnascar) / 16.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ffnascar > 16)& (ffnascar < 33))
|
||||
if ((ffnascar > 16) & (ffnascar < 33))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ffnascar - 16) / 16.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
else if ((ffnascar > 0)& (ffnascar < 17))
|
||||
else if ((ffnascar > 0) & (ffnascar < 17))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (17 - ffnascar) / 16.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
triggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Demul::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -13,73 +13,43 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "FordRacing.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
static HANDLE hSection;
|
||||
static LPVOID secData;
|
||||
static int ffbOffset = 0;
|
||||
|
||||
static int TeknoParrotGame()
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int const ff = GetTeknoParrotFFB();
|
||||
myHelpers->log("in FR Ffbloop");
|
||||
void FordRacing::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
helpers->log("in FR Ffbloop");
|
||||
const int ff = GetTeknoParrotFFB();
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff < -65505 && ff > -65515)
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
// -65507 => 9
|
||||
// -65508 => 8
|
||||
// -65515 => 1
|
||||
// weirdly, FR has 9 levels, not 15, utilizing only -65506 (weakest) to -65514 (strongest)
|
||||
double percentForce = (-65505 - ff) / 9.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
double percentLength = 50;
|
||||
// direction from left => makes wheel turn right
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
lastWasStop = 0;
|
||||
}
|
||||
else if (ff > 0 && ff < 16)
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
// weirdly, FR has 9 levels, not 15, utilizing 15 (weakest) through 7 (strongest)
|
||||
double percentForce = (16 - ff) / 9.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
double percentLength = 50;
|
||||
// direction from right => makes wheel turn left
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
lastWasStop = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FordRacing::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
TeknoParrotGame();
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
else
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (lastWasStop == 0) {
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
||||
lastWasStop = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
#include "../Common Files/TeknoParrotGame.h"
|
||||
|
||||
class FordRacing : public Game {
|
||||
class FordRacing : public TeknoParrotGame {
|
||||
public:
|
||||
FordRacing() : TeknoParrotGame() { }
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -13,11 +13,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "FordRacingOther.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static bool init = false;
|
||||
|
||||
static int __stdcall Out32(DWORD device, DWORD data)
|
||||
@ -65,11 +64,7 @@ static bool Hook(void * toHook, void * ourFunct, int len) {
|
||||
|
||||
static DWORD jmpBackAddy;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
void FordRacingOther::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
HMODULE hMod = GetModuleHandleA("inpout32.dll");
|
||||
if (hMod)
|
||||
{
|
||||
@ -86,23 +81,7 @@ static int RunningThread(void* ptr)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FordRacingOther::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -74,11 +74,14 @@ void GRID::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
triggers->Sine(80, 80, percentForce);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
=======
|
||||
>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
=======
|
||||
@ -113,9 +116,16 @@ void GRID::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
oldgear = newgear;
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
>>>>>>> parent of ede0f04... Fix GRID for Rumble to use duration of New Rumble
|
||||
=======
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc
|
||||
}
|
@ -14,95 +14,68 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
#include "GTIClub3.h"
|
||||
#include "math.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void GTIClub3::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
UINT8 ff = myHelpers->ReadByte(0x00918CBC, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = myHelpers->ReadByte(0x00918CBD, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = myHelpers->ReadByte(0x00918CBE, /* isRelativeOffset */ false);
|
||||
UINT8 menu = myHelpers->ReadByte(0x518E8E, /* isRelativeOffset */ true);
|
||||
myHelpers->log("got value: ");
|
||||
UINT8 ff = helpers->ReadByte(0x00918CBC, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = helpers->ReadByte(0x00918CBD, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = helpers->ReadByte(0x00918CBE, /* isRelativeOffset */ false);
|
||||
UINT8 menu = helpers->ReadByte(0x518E8E, /* isRelativeOffset */ true);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff2);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (FFBMode == 0)
|
||||
{
|
||||
if ((ff1 > 0x00)& (ff1 < 0x40)& (menu == 0))
|
||||
if ((ff1 > 0x00) & (ff1 < 0x40) & (menu == 0))
|
||||
{
|
||||
double percentForce = (ff1) / 63.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
if ((ff > 0x80)& (ff < 0x101)& (menu == 0))
|
||||
if ((ff > 0x80) & (ff < 0x101) & (menu == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (257 - ff) / 128.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00)& (ff < 0x80)& (menu == 0))
|
||||
else if ((ff > 0x00) & (ff < 0x80) & (menu == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 127.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff1 > 0x00)& (ff1 < 0x40)& (menu == 0))
|
||||
if ((ff1 > 0x00) & (ff1 < 0x40) & (menu == 0))
|
||||
{
|
||||
double percentForce = (ff1) / 63.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(pow(percentForce, 0.5), pow(percentForce, 0.5), percentLength);
|
||||
myTriggers->Sine(120, 120, pow(percentForce, 0.5));
|
||||
triggers->Rumble(pow(percentForce, 0.5), pow(percentForce, 0.5), percentLength);
|
||||
triggers->Sine(120, 120, pow(percentForce, 0.5));
|
||||
}
|
||||
if ((ff > 0x80)& (ff < 0x101)& (menu == 0))
|
||||
if ((ff > 0x80) & (ff < 0x101) & (menu == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (257 - ff) / 128.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
else if ((ff > 0x00)& (ff < 0x80)& (menu == 0))
|
||||
else if ((ff > 0x00) & (ff < 0x80) & (menu == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 127.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
triggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GTIClub3::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -274,10 +274,6 @@ static int RunningThread(void *ptr)
|
||||
|
||||
void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
|
||||
@ -330,4 +326,8 @@ void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
@ -14,29 +14,21 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
#include "InitialD4.h"
|
||||
#include "math.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void InitialD4::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers){
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
UINT8 ff = myHelpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = myHelpers->ReadByte(0x089AE899, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = myHelpers->ReadByte(0x089AE898, /* isRelativeOffset */ false);
|
||||
myHelpers->log("got value: ");
|
||||
UINT8 ff = helpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = helpers->ReadByte(0x089AE899, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = helpers->ReadByte(0x089AE898, /* isRelativeOffset */ false);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff2 == 0x86)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||
{
|
||||
@ -44,8 +36,10 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (0.6);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
@ -54,21 +48,21 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 55) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (73 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,38 +72,20 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD4::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers){
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,29 +14,20 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
#include "InitialD4Japan.h"
|
||||
#include "math.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void InitialD4Japan::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
UINT8 ff = myHelpers->ReadByte(0x0898985A, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = myHelpers->ReadByte(0x08989859, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = myHelpers->ReadByte(0x08989858, /* isRelativeOffset */ false);
|
||||
myHelpers->log("got value: ");
|
||||
UINT8 ff = helpers->ReadByte(0x0898985A, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = helpers->ReadByte(0x08989859, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = helpers->ReadByte(0x08989858, /* isRelativeOffset */ false);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff2 == 0x86)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||
{
|
||||
@ -44,8 +35,10 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (0.6);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
@ -54,21 +47,21 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 55) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (73 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,38 +71,20 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD4Japan::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,29 +14,21 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <string>
|
||||
#include "InitialD5.h"
|
||||
#include "math.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
UINT8 ff = myHelpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = myHelpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = myHelpers->ReadByte(0x08CB6120, /* isRelativeOffset */ false);
|
||||
myHelpers->log("got value: ");
|
||||
UINT8 ff = helpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = helpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false);
|
||||
UINT8 ff2 = helpers->ReadByte(0x08CB6120, /* isRelativeOffset */ false);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff2 == 0x86)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ff2 == 0x85) //cars colliding or rubbing against wall etc
|
||||
{
|
||||
@ -44,8 +36,10 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (0.6);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
@ -54,21 +48,21 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 55) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (73 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,38 +72,20 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "InitialD6.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
static HANDLE hSection;
|
||||
static LPVOID secData;
|
||||
static int ffbOffset = 0;
|
||||
|
||||
static int carscollide(int ffcollide) {
|
||||
switch (ffcollide) {
|
||||
@ -130,110 +122,77 @@ static int rubbingwalls(int ffwalls) {
|
||||
}
|
||||
}
|
||||
|
||||
static int TeknoParrotGame()
|
||||
void InitialD6::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ffrubbingwalls = 0;
|
||||
int ffcarcollision = 0;
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
myHelpers->log("in ID6 Ffbloop");
|
||||
helpers->log("in ID6 Ffbloop");
|
||||
const int ff = GetTeknoParrotFFB();
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
ffcarcollision = carscollide(ff);
|
||||
ffrubbingwalls = rubbingwalls(ff);
|
||||
|
||||
if (ff == 0x60000)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffrubbingwalls / 31.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffcarcollision / 16.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 262199) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (262473 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD6::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers){
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
TeknoParrotGame();
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
#include "../Common Files/TeknoParrotGame.h"
|
||||
|
||||
class InitialD6 : public Game {
|
||||
class InitialD6 : public TeknoParrotGame {
|
||||
public:
|
||||
InitialD6() : TeknoParrotGame() { }
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "InitialD7.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
static HANDLE hSection;
|
||||
static LPVOID secData;
|
||||
static int ffbOffset = 0;
|
||||
|
||||
static int carscollide(int ffcollide) {
|
||||
switch (ffcollide) {
|
||||
@ -130,110 +122,77 @@ static int rubbingwalls(int ffwalls) {
|
||||
}
|
||||
}
|
||||
|
||||
static int TeknoParrotGame()
|
||||
void InitialD7::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ffrubbingwalls = 0;
|
||||
int ffcarcollision = 0;
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
myHelpers->log("in ID6 Ffbloop");
|
||||
helpers->log("in ID7 Ffbloop");
|
||||
const int ff = GetTeknoParrotFFB();
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
ffcarcollision = carscollide(ff);
|
||||
ffrubbingwalls = rubbingwalls(ff);
|
||||
|
||||
if (ff == 0x60000)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffrubbingwalls / 31.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffcarcollision / 16.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 262199) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (262473 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD7::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
TeknoParrotGame();
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
#include "../Common Files/TeknoParrotGame.h"
|
||||
|
||||
class InitialD7 : public Game {
|
||||
class InitialD7 : public TeknoParrotGame {
|
||||
public:
|
||||
InitialD7() : TeknoParrotGame() { }
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "InitialD8.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
static HANDLE hSection;
|
||||
static LPVOID secData;
|
||||
static int ffbOffset = 0;
|
||||
|
||||
static int carscollide(int ffcollide) {
|
||||
switch (ffcollide) {
|
||||
@ -130,110 +122,77 @@ static int rubbingwalls(int ffwalls) {
|
||||
}
|
||||
}
|
||||
|
||||
static int TeknoParrotGame()
|
||||
void InitialD8::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers)
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ffrubbingwalls = 0;
|
||||
int ffcarcollision = 0;
|
||||
{
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
myHelpers->log("in ID6 Ffbloop");
|
||||
helpers->log("in ID8 Ffbloop");
|
||||
const int ff = GetTeknoParrotFFB();
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
ffcarcollision = carscollide(ff);
|
||||
ffrubbingwalls = rubbingwalls(ff);
|
||||
|
||||
if (ff == 0x60000)
|
||||
{
|
||||
myTriggers->Spring(0.8);
|
||||
triggers->Spring(0.8);
|
||||
}
|
||||
if (ffrubbingwalls > 0) // car rubbing against wall
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffrubbingwalls / 31.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (ffcarcollision > 0) //cars colliding or rubbing with each other
|
||||
{
|
||||
double percentLength = 200;
|
||||
double percentForce = (ffcarcollision / 16.0);
|
||||
myTriggers->Friction(percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Inertia(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
triggers->Damper(percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (ff - 262199) / 72.0;
|
||||
myTriggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(pow(percentForce, powforce), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce)));
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
double powforce = (262473 - ff) / 72.0;
|
||||
myTriggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
triggers->Rumble(0, pow(percentForce, powforce), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff > 0x40037)& (ff < 0x40080))
|
||||
if ((ff > 0x40037) & (ff < 0x40080))
|
||||
{
|
||||
double percentForce = (262272 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x40100)& (ff < 0x40149))
|
||||
else if ((ff > 0x40100) & (ff < 0x40149))
|
||||
{
|
||||
double percentForce = (ff - 262400) / 72.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialD8::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
TeknoParrotGame();
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
#include "../Common Files/TeknoParrotGame.h"
|
||||
|
||||
class InitialD8 : public Game {
|
||||
class InitialD8 : public TeknoParrotGame {
|
||||
public:
|
||||
InitialD8() : TeknoParrotGame() { }
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -13,87 +13,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "KODrive.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
UINT8 ff = myHelpers->ReadByte(0x00B261F6, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = myHelpers->ReadByte(0x00B261F5, /* isRelativeOffset */ false);
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void KODrive::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
UINT8 ff = helpers->ReadByte(0x00B261F6, /* isRelativeOffset */ false);
|
||||
UINT8 ff1 = helpers->ReadByte(0x00B261F5, /* isRelativeOffset */ false);
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if ((ff == 10) & (ff1 == 30))
|
||||
{
|
||||
double percentForce = 0.4;
|
||||
double percentForce1 = 1.0;
|
||||
double percentForce1 = 2.7;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
myTriggers->Sine(80, 80, percentForce);
|
||||
triggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
triggers->Sine(80, 80, percentForce);
|
||||
}
|
||||
if (FFBMode == 1)
|
||||
{
|
||||
if ((ff > 0x66)& (ff < 0x80)& (ff1 == 0))
|
||||
if ((ff > 0x66) & (ff < 0x80) & (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 24.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
else if ((ff > 0x00)& (ff < 0x19)& (ff1 == 1))
|
||||
else if ((ff > 0x00) & (ff < 0x19) & (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 24.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff > 0x66)& (ff < 0x80)& (ff1 == 0))
|
||||
if ((ff > 0x66) & (ff < 0x80) & (ff1 == 0))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 24.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00)& (ff < 0x19)& (ff1 == 1))
|
||||
else if ((ff > 0x00) & (ff < 0x19) & (ff1 == 1))
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 24.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KODrive::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -15,41 +15,30 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "LGI.h"
|
||||
#include "SDL.h"
|
||||
#include <Windows.h>
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ff = myHelpers->ReadIntPtr(0x0063BF5C, /* isRelativeOffset */ true);
|
||||
UINT8 ff1 = myHelpers->ReadByte(ff + 0x44, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p1 = myHelpers->ReadIntPtr(0x00820024, /* isRelativeOffset*/ true);
|
||||
INT_PTR health1p2 = myHelpers->ReadIntPtr(health1p1 + 0x4, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p3 = myHelpers->ReadIntPtr(health1p2 + 0x58, /* isRelativeOffset */ false);
|
||||
INT_PTR health2p3 = myHelpers->ReadIntPtr(health1p2 + 0x5C, /* isRelativeOffset */ false);
|
||||
float health1p = myHelpers->ReadFloat32(health1p3 + 0x14, /* isRelativeOffset */ false); //1p health
|
||||
float health2p = myHelpers->ReadFloat32(health2p3 + 0x14, /* isRelativeOffset */ false); //2p health
|
||||
myHelpers->log("got value: ");
|
||||
void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
int ff = helpers->ReadIntPtr(0x0063BF5C, /* isRelativeOffset */ true);
|
||||
UINT8 ff1 = helpers->ReadByte(ff + 0x44, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p1 = helpers->ReadIntPtr(0x00820024, /* isRelativeOffset*/ true);
|
||||
INT_PTR health1p2 = helpers->ReadIntPtr(health1p1 + 0x4, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p3 = helpers->ReadIntPtr(health1p2 + 0x58, /* isRelativeOffset */ false);
|
||||
INT_PTR health2p3 = helpers->ReadIntPtr(health1p2 + 0x5C, /* isRelativeOffset */ false);
|
||||
float health1p = helpers->ReadFloat32(health1p3 + 0x14, /* isRelativeOffset */ false); //1p health
|
||||
float health2p = helpers->ReadFloat32(health2p3 + 0x14, /* isRelativeOffset */ false); //2p health
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff1);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
float static oldFloat1 = 0.0;
|
||||
float static oldFloat2 = 0.0;
|
||||
float newFloat1 = health1p;
|
||||
float newFloat2 = health2p;
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
int HowtoRumbleKnockEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleKnockEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleMotorEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleMotorEffect"), 0, settingsFilename);
|
||||
@ -61,196 +50,9 @@ static int RunningThread(void* ptr)
|
||||
int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
|
||||
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if ((oldFloat2 != newFloat2) && (health2p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x20)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x40)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x8)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x24)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x48)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
oldFloat1 = newFloat1;
|
||||
oldFloat2 = newFloat2;
|
||||
}
|
||||
}
|
||||
|
||||
void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
@ -291,13 +93,180 @@ void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers*
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if ((oldFloat2 != newFloat2) && (health2p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x20)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x40)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x8)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x24)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x48)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
oldFloat1 = newFloat1;
|
||||
oldFloat2 = newFloat2;
|
||||
}
|
@ -15,41 +15,31 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "LGI3D.h"
|
||||
#include "SDL.h"
|
||||
#include <Windows.h>
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ff = myHelpers->ReadIntPtr(0x0065DA20, /* isRelativeOffset */ true);
|
||||
UINT8 ff1 = myHelpers->ReadByte(ff + 0x44, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p1 = myHelpers->ReadIntPtr(0x008429F4, /* isRelativeOffset*/ true);
|
||||
INT_PTR health1p2 = myHelpers->ReadIntPtr(health1p1 + 0x4, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p3 = myHelpers->ReadIntPtr(health1p2 + 0x74, /* isRelativeOffset */ false);
|
||||
INT_PTR health2p3 = myHelpers->ReadIntPtr(health1p2 + 0x78, /* isRelativeOffset */ false);
|
||||
float health1p = myHelpers->ReadFloat32(health1p3 + 0x14, /* isRelativeOffset */ false); //1p health
|
||||
float health2p = myHelpers->ReadFloat32(health2p3 + 0x14, /* isRelativeOffset */ false); //2p health
|
||||
myHelpers->log("got value: ");
|
||||
int ff = helpers->ReadIntPtr(0x0065DA20, /* isRelativeOffset */ true);
|
||||
UINT8 ff1 = helpers->ReadByte(ff + 0x44, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p1 = helpers->ReadIntPtr(0x008429F4, /* isRelativeOffset*/ true);
|
||||
INT_PTR health1p2 = helpers->ReadIntPtr(health1p1 + 0x4, /* isRelativeOffset */ false);
|
||||
INT_PTR health1p3 = helpers->ReadIntPtr(health1p2 + 0x74, /* isRelativeOffset */ false);
|
||||
INT_PTR health2p3 = helpers->ReadIntPtr(health1p2 + 0x78, /* isRelativeOffset */ false);
|
||||
float health1p = helpers->ReadFloat32(health1p3 + 0x14, /* isRelativeOffset */ false); //1p health
|
||||
float health2p = helpers->ReadFloat32(health2p3 + 0x14, /* isRelativeOffset */ false); //2p health
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff1);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
float static oldFloat1 = 0.0;
|
||||
float static oldFloat2 = 0.0;
|
||||
float newFloat1 = health1p;
|
||||
float newFloat2 = health2p;
|
||||
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
int HowtoRumbleKnockEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleKnockEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleMotorEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleMotorEffect"), 0, settingsFilename);
|
||||
@ -61,278 +51,9 @@ static int RunningThread(void* ptr)
|
||||
int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if ((oldFloat2 != newFloat2) && (health2p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x20)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x40)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x22)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x42)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x8)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x6)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0xA)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x24)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4A)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
oldFloat1 = newFloat1;
|
||||
oldFloat2 = newFloat2;
|
||||
}
|
||||
}
|
||||
|
||||
void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
@ -373,13 +94,264 @@ void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if ((oldFloat2 != newFloat2) && (health2p != 0x1))
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x20)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x40)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x22)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x42)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x8)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x6)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0xA)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x24)
|
||||
{
|
||||
if (HowtoRumbleKnockEffect == 0)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 1)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleKnockEffect == 2)
|
||||
{
|
||||
double percentForce = ((Knock1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (ff1 == 0x4A)
|
||||
{
|
||||
if (HowtoRumbleMotorEffect == 0)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 1)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleMotorEffect == 2)
|
||||
{
|
||||
double percentForce = ((Motor1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
oldFloat1 = newFloat1;
|
||||
oldFloat2 = newFloat2;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -13,18 +13,13 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "Machstorm.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned int U32;
|
||||
typedef uint16_t U16;
|
||||
void Machstorm::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int DomeFix = GetPrivateProfileInt(TEXT("Settings"), TEXT("DomeFix"), 0, settingsFilename);
|
||||
int Power1RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power1RumbleStrength"), 0, settingsFilename);
|
||||
int Power2RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power2RumbleStrength"), 0, settingsFilename);
|
||||
int Power3RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power3RumbleStrength"), 0, settingsFilename);
|
||||
@ -45,8 +40,8 @@ static int RunningThread(void* ptr)
|
||||
int Power8RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power8RumbleLength"), 0, settingsFilename);
|
||||
int Power9RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power9RumbleLength"), 0, settingsFilename);
|
||||
int Power10RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power10RumbleLength"), 0, settingsFilename);
|
||||
int vibration = myHelpers->ReadInt32(0x6390E9, /* relative */ true);
|
||||
int power = myHelpers->ReadInt32(0x639109, /* relative */ true);
|
||||
int vibration = helpers->ReadInt32(0x6390E9, /* relative */ true);
|
||||
int power = helpers->ReadInt32(0x639109, /* relative */ true);
|
||||
|
||||
if (vibration == 16842753)
|
||||
{
|
||||
@ -54,61 +49,61 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentLength = (Power1RumbleLength);
|
||||
double percentForce = ((Power1RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61543)
|
||||
{
|
||||
double percentLength = (Power2RumbleLength);
|
||||
double percentForce = ((Power2RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61544)
|
||||
{
|
||||
double percentLength = (Power3RumbleLength);
|
||||
double percentForce = ((Power3RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61545)
|
||||
{
|
||||
double percentLength = (Power4RumbleLength);
|
||||
double percentForce = ((Power4RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61546)
|
||||
{
|
||||
double percentLength = (Power5RumbleLength);
|
||||
double percentForce = ((Power5RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61547)
|
||||
{
|
||||
double percentLength = (Power6RumbleLength);
|
||||
double percentForce = ((Power6RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61548)
|
||||
{
|
||||
double percentLength = (Power7RumbleLength);
|
||||
double percentForce = ((Power7RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61549)
|
||||
{
|
||||
double percentLength = (Power8RumbleLength);
|
||||
double percentForce = ((Power8RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61550)
|
||||
{
|
||||
double percentLength = (Power9RumbleLength);
|
||||
double percentForce = ((Power9RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 61551)
|
||||
{
|
||||
double percentLength = (Power10RumbleLength);
|
||||
double percentForce = ((Power10RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
if (vibration == 1)
|
||||
@ -117,79 +112,61 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentLength = (Power1RumbleLength);
|
||||
double percentForce = ((Power1RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773367)
|
||||
{
|
||||
double percentLength = (Power2RumbleLength);
|
||||
double percentForce = ((Power2RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773368)
|
||||
{
|
||||
double percentLength = (Power3RumbleLength);
|
||||
double percentForce = ((Power3RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773369)
|
||||
{
|
||||
double percentLength = (Power4RumbleLength);
|
||||
double percentForce = ((Power4RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773370)
|
||||
{
|
||||
double percentLength = (Power5RumbleLength);
|
||||
double percentForce = ((Power5RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773371)
|
||||
{
|
||||
double percentLength = (Power6RumbleLength);
|
||||
double percentForce = ((Power6RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773372)
|
||||
{
|
||||
double percentLength = (Power7RumbleLength);
|
||||
double percentForce = ((Power7RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773373)
|
||||
{
|
||||
double percentLength = (Power8RumbleLength);
|
||||
double percentForce = ((Power8RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773374)
|
||||
{
|
||||
double percentLength = (Power9RumbleLength);
|
||||
double percentForce = ((Power9RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (power == 16773375)
|
||||
{
|
||||
double percentLength = (Power10RumbleLength);
|
||||
double percentForce = ((Power10RumbleStrength) / 100.0);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void Machstorm::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class Machstorm : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -13,31 +13,24 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "MarioKartGPDX.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ff1 = myHelpers->ReadInt32(0x564C5F, /* isRelativeOffset */ true); //shake
|
||||
int ff2 = myHelpers->ReadInt32(0x559B68,/* isRelativeOffset */ true);
|
||||
int ff3 = myHelpers->ReadInt32(ff2 + 0x5F8, /* isRelativeOffset */ false); // terrain data
|
||||
int ff4 = myHelpers->ReadInt32(0x563860, /* isRelativeOffset */ true); //0-255 accl
|
||||
int ff5 = myHelpers->ReadInt32(ff2 + 0x628, /* isRelativeOffset */ false); //kart flying or on ground
|
||||
int ff6 = myHelpers->ReadInt32(0x5532C4,/* isRelativeOffset */ true);
|
||||
int ff7 = myHelpers->ReadInt32(ff6 + 0x1F0, /* isRelativeOffset */ false);
|
||||
int ff8 = myHelpers->ReadInt32(ff7 + 0x18, /* isRelativeOffset */ false);
|
||||
int ff9 = myHelpers->ReadInt32(ff8 + 0x7C, /* isRelativeOffset */ false);
|
||||
int ff10 = myHelpers->ReadInt32(ff9 + 0x164, /* isRelativeOffset */ false); // 1 during race only
|
||||
int ff11 = myHelpers->ReadInt32(ff2 + 0x520, /* isRelativeOffset */ false); //1065353216 when kart moves
|
||||
myHelpers->log("got value: ");
|
||||
void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
helpers->log("in MKDX Ffbloop");
|
||||
|
||||
int ff1 = helpers->ReadInt32(0x564C5F, /* isRelativeOffset */ true); //shake
|
||||
int ff2 = helpers->ReadInt32(0x559B68,/* isRelativeOffset */ true);
|
||||
int ff3 = helpers->ReadInt32(ff2 + 0x5F8, /* isRelativeOffset */ false); // terrain data
|
||||
int ff4 = helpers->ReadInt32(0x563860, /* isRelativeOffset */ true); //0-255 accl
|
||||
int ff5 = helpers->ReadInt32(ff2 + 0x628, /* isRelativeOffset */ false); //kart flying or on ground
|
||||
int ff6 = helpers->ReadInt32(0x5532C4,/* isRelativeOffset */ true);
|
||||
int ff7 = helpers->ReadInt32(ff6 + 0x1F0, /* isRelativeOffset */ false);
|
||||
int ff8 = helpers->ReadInt32(ff7 + 0x18, /* isRelativeOffset */ false);
|
||||
int ff9 = helpers->ReadInt32(ff8 + 0x7C, /* isRelativeOffset */ false);
|
||||
int ff10 = helpers->ReadInt32(ff9 + 0x164, /* isRelativeOffset */ false); // 1 during race only
|
||||
int ff11 = helpers->ReadInt32(ff2 + 0x520, /* isRelativeOffset */ false); //1065353216 when kart moves
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff1);
|
||||
myHelpers->log((char*)ffs.c_str()); myHelpers->log("got value: ");
|
||||
helpers->log((char *)ffs.c_str()); helpers->log("got value: ");
|
||||
|
||||
|
||||
// Large Shake when hitting walls, other karts or getting hit by items
|
||||
@ -47,8 +40,8 @@ static int RunningThread(void* ptr)
|
||||
double percentForce = 1.0;
|
||||
double percentForce1 = 3.5;
|
||||
double percentLength = (500);
|
||||
myTriggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
myTriggers->Sine(200, 200, percentForce);
|
||||
triggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
triggers->Sine(200, 200, percentForce);
|
||||
}
|
||||
|
||||
// small friction when driving on dirt while moving
|
||||
@ -56,8 +49,8 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentForce = (0.3);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
// Small constant when hitting bumps
|
||||
else if ((10 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -65,8 +58,8 @@ static int RunningThread(void* ptr)
|
||||
double percentForce = (0.2);
|
||||
double percentLength = (50);
|
||||
double percentForce1 = 3.0;
|
||||
myTriggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(percentForce1, percentForce1, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
// Wheel rumbles while driving on grass
|
||||
else if ((4 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -74,14 +67,14 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentForce = 0.2;
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
//wheel hard to turn while driving through water
|
||||
else if ((7 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
{
|
||||
double percentForce = (0.65);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
//Wheel rumbles lightly when driving over tiles
|
||||
else if ((12 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -90,8 +83,8 @@ static int RunningThread(void* ptr)
|
||||
double percentForce = 0.1;
|
||||
double percentForce1 = 0.2;
|
||||
double percentLength = (150);
|
||||
myTriggers->Rumble(percentForce1, 0, percentLength);
|
||||
myTriggers->Sine(70, 70, percentForce);
|
||||
triggers->Rumble(percentForce1, 0, percentLength);
|
||||
triggers->Sine(70, 70, percentForce);
|
||||
}
|
||||
//Wheel rumbles lightly when driving over sand
|
||||
else if ((14 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -100,8 +93,8 @@ static int RunningThread(void* ptr)
|
||||
double percentForce = 0.1;
|
||||
double percentForce1 = 0.2;
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(percentForce1, 0, percentLength);
|
||||
myTriggers->Sine(70, 70, percentForce);
|
||||
triggers->Rumble(percentForce1, 0, percentLength);
|
||||
triggers->Sine(70, 70, percentForce);
|
||||
}
|
||||
//Wheel rumbles lightly when driving over rough part of track
|
||||
else if ((11 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -110,8 +103,8 @@ static int RunningThread(void* ptr)
|
||||
double percentForce = 0.1;
|
||||
double percentForce1 = 0.2;
|
||||
double percentLength = (250);
|
||||
myTriggers->Rumble(0, percentForce1, percentLength);
|
||||
myTriggers->Sine(40, 50, percentForce);
|
||||
triggers->Rumble(0, percentForce1, percentLength);
|
||||
triggers->Sine(40, 50, percentForce);
|
||||
}
|
||||
//Wheel rumbles moderately when driving over wooden bridges
|
||||
else if ((8 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216))
|
||||
@ -119,26 +112,7 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentForce = 0.4;
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MarioKartGPDX100::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class MarioKartGPDX100 : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -49,34 +49,25 @@ static int RoughTrackRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEX
|
||||
static int BridgeRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("BridgeRumble"), 0, settingsFilename);
|
||||
static int BridgeRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("BridgeRumbleStrength"), 0, settingsFilename);
|
||||
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
INT_PTR ff1 = myHelpers->ReadIntPtr(0xA46974, /* isRelativeOffset */ true); //shake
|
||||
INT_PTR ff2 = myHelpers->ReadIntPtr(0x00A416E4,/* isRelativeOffset */ true);
|
||||
UINT8 ff3 = myHelpers->ReadByte(ff2 + 0x628, /* isRelativeOffset */ false); // terrain data
|
||||
UINT8 ff5 = myHelpers->ReadByte(ff2 + 0x658, /* isRelativeOffset */ false); //kart flying or on ground
|
||||
INT_PTR ff6 = myHelpers->ReadIntPtr(0x00A309A0,/* isRelativeOffset */ true);
|
||||
INT_PTR ff7 = myHelpers->ReadIntPtr(ff6 + 0x304, /* isRelativeOffset */ false);
|
||||
INT_PTR ff8 = myHelpers->ReadIntPtr(ff7 + 0xE8, /* isRelativeOffset */ false);
|
||||
INT_PTR ff9 = myHelpers->ReadIntPtr(ff8 + 0x64, /* isRelativeOffset */ false);
|
||||
INT_PTR ff10 = myHelpers->ReadIntPtr(ff9 + 0x38, /* isRelativeOffset */ false);
|
||||
UINT8 ff11 = myHelpers->ReadByte(ff10 + 0x4C4, /* isRelativeOffset */ false); // 1 during race only
|
||||
float Speed = myHelpers->ReadFloat32(ff2 + 0x558, /* isRelativeOffset */ false); //Speed of Kart
|
||||
UINT8 ff13 = myHelpers->ReadByte(0xA39690, /* isRelativeOffset */ true); //picking up coins
|
||||
UINT8 ff14 = myHelpers->ReadByte(0xA4528D, /* isRelativeOffset */ true); //picking up weapon box
|
||||
UINT8 Wheel = myHelpers->ReadByte(0xA4652D, /* isRelativeOffset */ true); //0-255 steering
|
||||
INT_PTR ff16 = myHelpers->ReadIntPtr(0x00A2E284, /* isRelativeOffset*/ true);
|
||||
UINT8 ff17 = myHelpers->ReadByte(ff2 + 0x674, /* isRelativeOffset */ false); // Drift
|
||||
UINT8 ff18 = myHelpers->ReadByte(ff16 + 0x3A4, /* isRelativeOffset */ false); // Boost
|
||||
INT_PTR ff1 = helpers->ReadIntPtr(0xA46974, /* isRelativeOffset */ true); //shake
|
||||
INT_PTR ff2 = helpers->ReadIntPtr(0x00A416E4,/* isRelativeOffset */ true);
|
||||
UINT8 ff3 = helpers->ReadByte(ff2 + 0x628, /* isRelativeOffset */ false); // terrain data
|
||||
UINT8 ff5 = helpers->ReadByte(ff2 + 0x658, /* isRelativeOffset */ false); //kart flying or on ground
|
||||
INT_PTR ff6 = helpers->ReadIntPtr(0x00A309A0,/* isRelativeOffset */ true);
|
||||
INT_PTR ff7 = helpers->ReadIntPtr(ff6 + 0x304, /* isRelativeOffset */ false);
|
||||
INT_PTR ff8 = helpers->ReadIntPtr(ff7 + 0xE8, /* isRelativeOffset */ false);
|
||||
INT_PTR ff9 = helpers->ReadIntPtr(ff8 + 0x64, /* isRelativeOffset */ false);
|
||||
INT_PTR ff10 = helpers->ReadIntPtr(ff9 + 0x38, /* isRelativeOffset */ false);
|
||||
UINT8 ff11 = helpers->ReadByte(ff10 + 0x4C4, /* isRelativeOffset */ false); // 1 during race only
|
||||
float Speed = helpers->ReadFloat32(ff2 + 0x558, /* isRelativeOffset */ false); //Speed of Kart
|
||||
UINT8 ff13 = helpers->ReadByte(0xA39690, /* isRelativeOffset */ true); //picking up coins
|
||||
UINT8 ff14 = helpers->ReadByte(0xA4528D, /* isRelativeOffset */ true); //picking up weapon box
|
||||
UINT8 Wheel = helpers->ReadByte(0xA4652D, /* isRelativeOffset */ true); //0-255 steering
|
||||
INT_PTR ff16 = helpers->ReadIntPtr(0x00A2E284, /* isRelativeOffset*/ true);
|
||||
UINT8 ff17 = helpers->ReadByte(ff2 + 0x674, /* isRelativeOffset */ false); // Drift
|
||||
UINT8 ff18 = helpers->ReadByte(ff16 + 0x3A4, /* isRelativeOffset */ false); // Boost
|
||||
|
||||
int static oldcoins = 0;
|
||||
int newcoins = ff13;
|
||||
@ -84,9 +75,9 @@ static int RunningThread(void* ptr)
|
||||
int newweapon = ff14;
|
||||
int static oldhitground = 0;
|
||||
int newhitground = ff5;
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff1);
|
||||
myHelpers->log((char*)ffs.c_str()); myHelpers->log("got value: ");
|
||||
helpers->log((char *)ffs.c_str()); helpers->log("got value: ");
|
||||
|
||||
if ((ConstantEffectForSteering == 1) && (ff11 == 1))
|
||||
{
|
||||
@ -94,15 +85,15 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0));
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((Wheel > 127)& (Wheel < 256))
|
||||
else if ((Wheel > 127) & (Wheel < 256))
|
||||
{
|
||||
double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0));
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
if ((MainShakeRumble == 1) & (4194308 == ff1) & (ff11 == 1))
|
||||
@ -110,161 +101,142 @@ static int RunningThread(void* ptr)
|
||||
// Large Shake when hitting walls, other karts or getting hit by items
|
||||
double percentForce = ((MainShakeRumbleStrength) / 100.0);
|
||||
double percentLength = (500);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(200, 200, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(200, 200, percentForce);
|
||||
}
|
||||
else if ((BoostRumble == 1) & (ff18 == 1) & (ff11 == 1))
|
||||
{
|
||||
// Shake when Boost
|
||||
double percentForce = ((BoostRumbleStrength) / 100.0);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(60, 60, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(60, 60, percentForce);
|
||||
}
|
||||
else if ((DriftRumble == 1) & (ff17 == 1) & (Wheel >= 0) & (Wheel < 128) & (ff11 == 1))
|
||||
{
|
||||
// Drift Effect including steering left
|
||||
double percentForce = (((128 - Wheel) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((DriftRumble == 1) & (ff17 == 1) & (Wheel > 127)& (Wheel < 256)& (ff11 == 1))
|
||||
else if ((DriftRumble == 1) & (ff17 == 1) & (Wheel > 127) & (Wheel < 256) & (ff11 == 1))
|
||||
{
|
||||
// Drift Effect including steering right
|
||||
double percentForce = (((Wheel - 127) / 128.0) * (DriftRumbleControllerStrengthMultiplier / 100.0));
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((HitGroundRumble == 1) & (oldhitground != newhitground) & (ff5 == 1) & (ff11 == 1))
|
||||
{
|
||||
// Shake when hitting ground
|
||||
double percentForce = ((HitGroundRumbleStrength) / 100.0);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
Sleep(50);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((WeaponRumble == 1) & (oldweapon != newweapon) & (ff11 == 1))
|
||||
{
|
||||
// Shake when picking up new weapons or using them
|
||||
double percentForce = ((WeaponRumbleStrength) / 100.0);
|
||||
double percentLength = (300);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(80, 50, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(80, 50, percentForce);
|
||||
}
|
||||
else if ((CoinRumble == 1) & (oldcoins != newcoins) & (ff11 == 1))
|
||||
{
|
||||
// Shake when picking up coins
|
||||
double percentForce = ((CoinRumbleStrength) / 100.0);
|
||||
double percentLength = (200);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
else if ((DirtRumble == 1) & (3 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
// small friction when driving on dirt while moving
|
||||
double percentForce = ((DirtRumbleStrength) / 100.0);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((SpeedBumpRumble == 1) & (10 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
// Small constant when hitting bumps
|
||||
double percentForce = ((SpeedBumpRumbleStrength) / 100.0);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, 0);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0);
|
||||
}
|
||||
else if ((GrassRumble == 1) & (4 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
// Wheel rumbles while driving on grass
|
||||
double percentForce = ((GrassRumbleStrength) / 100.0);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
else if ((CarpetRumble == 1) & (9 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
// Wheel rumbles while driving on carpet
|
||||
double percentForce = ((CarpetRumbleStrength) / 100.0);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)& (Wheel >= 0)& (Wheel < 128))
|
||||
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel >= 0) & (Wheel < 128))
|
||||
{
|
||||
//wheel hard to turn while driving through water
|
||||
double percentForce = ((WaterRumbleWheelStrength) / 100.0);
|
||||
double percentForce1 = ((128 - Wheel / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0));
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce1, 0, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(percentForce1, 0, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1)& (Wheel > 127))
|
||||
else if ((WaterRumble == 1) & (7 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1) & (Wheel > 127))
|
||||
{
|
||||
double percentForce = ((WaterRumbleWheelStrength) / 100.0);
|
||||
double percentForce1 = ((Wheel - 127 / 128.0) * (WaterRumbleControllerStrengthMultiplier / 100.0));
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(0, percentForce1, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(0, percentForce1, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((TileRumble == 1) & (12 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
//Wheel rumbles lightly when driving over tiles
|
||||
double percentForce = ((TileRumbleStrength) / 100.0);
|
||||
double percentLength = (150);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((SandRumble == 1) & (14 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
//Wheel rumbles lightly when driving over sand
|
||||
double percentForce = ((SandRumbleStrength) / 100.0);
|
||||
double percentLength = (50);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Sine(70, 70, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Sine(70, 70, percentForce);
|
||||
}
|
||||
else if ((RoughTrackRumble == 1) & (11 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
//Wheel rumbles lightly when driving over rough part of track
|
||||
double percentForce = ((RoughTrackRumbleStrength) / 100.0);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Sine(40, 50, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Sine(40, 50, percentForce);
|
||||
}
|
||||
else if ((BridgeRumble == 1) & (8 == ff3) & (ff11 == 1) & (ff5 == 1) & (Speed > 0.1))
|
||||
{
|
||||
//Wheel rumbles moderately when driving over wooden bridges
|
||||
double percentForce = ((BridgeRumbleStrength) / 100.0);
|
||||
double percentLength = (100);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
oldcoins = newcoins;
|
||||
oldweapon = newweapon;
|
||||
oldhitground = newhitground;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class MarioKartGPDX110 : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -255,13 +255,7 @@ static int RunningThread(void *ptr)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OutRun2Fake::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||
|
@ -20,7 +20,6 @@ static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
static int SpeedStrength;
|
||||
static bool init = true;
|
||||
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);
|
||||
@ -96,16 +95,6 @@ static int RunningThread(void *ptr)
|
||||
UINT8 static oldgear = 0;
|
||||
float newgear = gear;
|
||||
|
||||
if (init)
|
||||
{
|
||||
DWORD tempdw = 0x08105A48;
|
||||
DWORD loadffb = (DWORD)(void*)or2FfbFunction;
|
||||
DWORD tempdw2 = loadffb - tempdw - 5;
|
||||
*(BYTE*)tempdw = 0xE9;
|
||||
*(DWORD*)(tempdw + 1) = tempdw2;
|
||||
init = false;
|
||||
}
|
||||
|
||||
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||
{
|
||||
SpeedStrength = 10;
|
||||
@ -164,16 +153,21 @@ static int RunningThread(void *ptr)
|
||||
}
|
||||
|
||||
void OutRun2Real::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
bool init = true;
|
||||
if (init)
|
||||
{
|
||||
DWORD tempdw = 0x08105A48;
|
||||
DWORD loadffb = (DWORD)(void *)or2FfbFunction;
|
||||
DWORD tempdw2 = loadffb - tempdw - 5;
|
||||
*(BYTE *)tempdw = 0xE9;
|
||||
*(DWORD *)(tempdw + 1) = tempdw2;
|
||||
init = false;
|
||||
}
|
||||
UINT8 transmission = helpers->ReadByte(0x082932C2, /* isRelativeOffset */ false); // Auto or Manual
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
|
@ -13,28 +13,20 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "PokkenTournament.h"
|
||||
#include "SDL.h"
|
||||
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
void PokkenTournament::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
INT_PTR ffAddress = myHelpers->ReadIntPtr(0x00E97F10, /* isRelativeOffset*/ true);
|
||||
INT_PTR ff1 = myHelpers->ReadIntPtr(ffAddress + 0x60, /* isRelativeOffset */ false);
|
||||
INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x8, /* isRelativeOffset */ false);
|
||||
float ff3 = myHelpers->ReadFloat32(ff2 + 0xCC, /* isRelativeOffset */ false); //health
|
||||
INT_PTR ffAddress4 = myHelpers->ReadIntPtr(0x00EC4C20, /* isRelativeOffset*/ true);
|
||||
INT_PTR ff5 = myHelpers->ReadIntPtr(ffAddress4 + 0x60, /* isRelativeOffset */ false);
|
||||
INT_PTR ff6 = myHelpers->ReadIntPtr(ff5 + 0x120, /* isRelativeOffset */ false);
|
||||
INT_PTR ff7 = myHelpers->ReadIntPtr(ff6 + 0x698, /* isRelativeOffset */ false); //1 during battle except for first startup
|
||||
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
INT_PTR ffAddress = helpers->ReadIntPtr(0x00E97F10, /* isRelativeOffset*/ true);
|
||||
INT_PTR ff1 = helpers->ReadIntPtr(ffAddress + 0x60, /* isRelativeOffset */ false);
|
||||
INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x8, /* isRelativeOffset */ false);
|
||||
float ff3 = helpers->ReadFloat32(ff2 + 0xCC, /* isRelativeOffset */ false); //health
|
||||
INT_PTR ffAddress4 = helpers->ReadIntPtr(0x00EC4C20, /* isRelativeOffset*/ true);
|
||||
INT_PTR ff5 = helpers->ReadIntPtr(ffAddress4 + 0x60, /* isRelativeOffset */ false);
|
||||
INT_PTR ff6 = helpers->ReadIntPtr(ff5 + 0x120, /* isRelativeOffset */ false);
|
||||
INT_PTR ff7 = helpers->ReadIntPtr(ff6 + 0x698, /* isRelativeOffset */ false); //1 during battle except for first startup
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
|
||||
int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename);
|
||||
int HowtoRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumble"), 0, settingsFilename);
|
||||
@ -42,9 +34,9 @@ static int RunningThread(void* ptr)
|
||||
float static oldFloat = 0.0;
|
||||
float newFloat = ff3;
|
||||
|
||||
myHelpers->log("got value: ");
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff3);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
|
||||
if ((oldFloat != newFloat))
|
||||
@ -53,39 +45,20 @@ static int RunningThread(void* ptr)
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumble == 1)
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumble == 2)
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
oldFloat = newFloat;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PokkenTournament::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class PokkenTournament : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -292,10 +292,6 @@ static int RunningThread(void *ptr)
|
||||
|
||||
void RoadFighters3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
if (InputDeviceWheelEnable == 1)
|
||||
{
|
||||
SDL_Thread *thread;
|
||||
|
@ -13,121 +13,93 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "SegaRacingClassic.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
UINT8 ff = myHelpers->ReadByte(0x834C19, /* isRelativeOffset */ false);
|
||||
myHelpers->log("got value: ");
|
||||
void SegaRacingClassic::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
UINT8 ff = helpers->ReadByte(0x834C19, /* isRelativeOffset */ false);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
helpers->log((char *)ffs.c_str());
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
|
||||
|
||||
if (FFBMode == 0)
|
||||
{
|
||||
if ((ff > 0xD7)& (ff < 0xE0))
|
||||
if ((ff > 0xD7) & (ff < 0xE0))
|
||||
{
|
||||
//Clutch
|
||||
double percentForce = (224 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else if ((ff > 0xBF)& (ff < 0xC8))
|
||||
else if ((ff > 0xBF) & (ff < 0xC8))
|
||||
{
|
||||
//Centering
|
||||
double percentForce = (200 - ff) / 8.0;
|
||||
double percentForce = (200 - ff ) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Spring(pow(percentForce, 0.1));
|
||||
triggers->Spring(pow(percentForce, 0.1));
|
||||
}
|
||||
else if ((ff > 0xB7)& (ff < 0xC0))
|
||||
else if ((ff > 0xB7) & (ff < 0xC0))
|
||||
{
|
||||
//Uncentering
|
||||
double percentForce = (192 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Sine(70, 80, percentForce);
|
||||
triggers->Sine(70, 80, percentForce);
|
||||
}
|
||||
else if ((ff > 0xA7)& (ff < 0xB0))
|
||||
else if ((ff > 0xA7) & (ff < 0xB0))
|
||||
{
|
||||
//Roll Left
|
||||
double percentForce = (176 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x97)& (ff < 0xA0))
|
||||
else if ((ff > 0x97) & (ff < 0xA0))
|
||||
{
|
||||
//Roll Right
|
||||
double percentForce = (160 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff > 0xD7)& (ff < 0xE0))
|
||||
if ((ff > 0xD7) & (ff < 0xE0))
|
||||
{
|
||||
//Clutch
|
||||
double percentForce = (224 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Friction(pow(percentForce, 0.5));
|
||||
triggers->Friction(pow(percentForce, 0.5));
|
||||
}
|
||||
else if ((ff > 0xBF)& (ff < 0xC8))
|
||||
else if ((ff > 0xBF) & (ff < 0xC8))
|
||||
{
|
||||
//Centering
|
||||
double percentForce = (200 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Spring(pow(percentForce, 0.1));
|
||||
triggers->Spring(pow(percentForce, 0.1));
|
||||
}
|
||||
else if ((ff > 0xB7)& (ff < 0xC0))
|
||||
else if ((ff > 0xB7) & (ff < 0xC0))
|
||||
{
|
||||
//Uncentering
|
||||
double percentForce = (192 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Sine(70, 80, pow(percentForce, 0.5));
|
||||
triggers->Sine(70, 80, pow(percentForce, 0.5));
|
||||
}
|
||||
else if ((ff > 0xA7)& (ff < 0xB0))
|
||||
else if ((ff > 0xA7) & (ff < 0xB0))
|
||||
{
|
||||
//Roll Left
|
||||
double percentForce = (176 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(0, pow(percentForce, 0.5), percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
else if ((ff > 0x97)& (ff < 0xA0))
|
||||
else if ((ff > 0x97) & (ff < 0xA0))
|
||||
{
|
||||
//Roll Right
|
||||
double percentForce = (160 - ff) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
triggers->Rumble(pow(percentForce, 0.5), 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SegaRacingClassic::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class SegaRacingClassic : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -13,73 +13,40 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "SegaRally3.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
static HANDLE hSection;
|
||||
static LPVOID secData;
|
||||
static int ffbOffset = 0;
|
||||
|
||||
static int TeknoParrotGame()
|
||||
{
|
||||
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
|
||||
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64);
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetTeknoParrotFFB()
|
||||
{
|
||||
ffbOffset = *((int*)secData + 2);
|
||||
return ffbOffset;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
myHelpers->log("in SR3 Ffbloop");
|
||||
void SegaRally3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
helpers->log("in SR3 Ffbloop");
|
||||
const int ff = GetTeknoParrotFFB();
|
||||
std::string ffs = std::to_string(ff);
|
||||
myHelpers->log((char*)ffs.c_str());
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff > 15)
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
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;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
// direction from left => makes wheel turn right
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
lastWasStop = 0;
|
||||
}
|
||||
else if (ff > 0)
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
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;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
// direction from right => makes wheel turn left
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
lastWasStop = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SegaRally3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
TeknoParrotGame();
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
else
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (lastWasStop == 0) {
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
||||
lastWasStop = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
#include "../Common Files/TeknoParrotGame.h"
|
||||
|
||||
class SegaRally3 : public Game {
|
||||
class SegaRally3 : public TeknoParrotGame {
|
||||
public:
|
||||
SegaRally3() : TeknoParrotGame() { }
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
};
|
@ -13,64 +13,44 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "SonicSegaAllStarsRacing.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
INT_PTR FFBEnable = myHelpers->ReadByte(0x5CD858, /* isRelativeOffset*/ true);
|
||||
INT_PTR FFB = myHelpers->ReadByte(0x5CD864, /* isRelativeOffset*/ true);
|
||||
void SonicSegaAllStarsRacing::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
INT_PTR FFBEnable = helpers->ReadByte(0x5CD858, /* isRelativeOffset*/ true);
|
||||
INT_PTR FFB = helpers->ReadByte(0x5CD864, /* isRelativeOffset*/ true);
|
||||
|
||||
{
|
||||
//Enable FFB
|
||||
myHelpers->WriteByte(0x5CD858, 0x03, true);
|
||||
helpers->WriteByte(0x5CD858, 0x03, true);
|
||||
}
|
||||
|
||||
{
|
||||
//Trigger friction to stop any oscillation
|
||||
double percentForce = 0.2;
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
|
||||
if ((FFB > 0)& (FFB < 19))
|
||||
if ((FFB > 0) & (FFB < 19))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (FFB) / 18.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
lastWasStop = 0;
|
||||
|
||||
}
|
||||
else if ((FFB > 237)& (FFB < 256))
|
||||
else if ((FFB > 237) & (FFB < 256))
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (256 - FFB) / 18.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
lastWasStop = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SonicSegaAllStarsRacing::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
else
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (lastWasStop == 0) {
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
||||
lastWasStop = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class SonicSegaAllStarsRacing : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class TestGame : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -136,124 +136,124 @@ static int GearChangeThread(void* ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
void WMMT5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
if (!init)
|
||||
{
|
||||
init = true;
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
SDL_CreateThread(InputThread, "InputThread", (void*)NULL);
|
||||
SDL_CreateThread(SpamThread, "SpamThread", (void*)NULL);
|
||||
}
|
||||
|
||||
float spring = myHelpers->ReadFloat32(0x196F18C, true);
|
||||
float friction = myHelpers->ReadFloat32(0x196F190, true);
|
||||
float collisions = myHelpers->ReadFloat32(0x196F194, true);
|
||||
float tiresSlip = myHelpers->ReadFloat32(0x196F188, true);
|
||||
int speed = myHelpers->ReadInt32(0x196FEBC, true);
|
||||
float spring = helpers->ReadFloat32(0x196F18C, true);
|
||||
float friction = helpers->ReadFloat32(0x196F190, true);
|
||||
float collisions = helpers->ReadFloat32(0x196F194, true);
|
||||
float tiresSlip = helpers->ReadFloat32(0x196F188, true);
|
||||
int speed = helpers->ReadInt32(0x196FEBC, true);
|
||||
std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction)
|
||||
+ " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip)
|
||||
+ " | speed: " + std::to_string(speed);
|
||||
myHelpers->log((char*)msg.c_str());
|
||||
helpers->log((char*)msg.c_str());
|
||||
|
||||
double percentForce;
|
||||
if (0.001 > spring && !gameFfbStarted)
|
||||
{
|
||||
myHelpers->log("fake spring+friction until game's FFB starts");
|
||||
helpers->log("fake spring+friction until game's FFB starts");
|
||||
percentForce = 0.3 * SpringStrength / 100.0;
|
||||
myTriggers->Spring(percentForce);
|
||||
triggers->Spring(percentForce);
|
||||
percentForce = 0.5 * FrictionStrength / 100.0;
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gameFfbStarted)
|
||||
{
|
||||
myHelpers->log("game's FFB started");
|
||||
helpers->log("game's FFB started");
|
||||
gameFfbStarted = true;
|
||||
}
|
||||
percentForce = (1.0 * spring) * SpringStrength / 100.0;
|
||||
myTriggers->Spring(percentForce);
|
||||
triggers->Spring(percentForce);
|
||||
percentForce = (1.0 * friction) * FrictionStrength / 100.0;
|
||||
myTriggers->Friction(percentForce);
|
||||
triggers->Friction(percentForce);
|
||||
}
|
||||
|
||||
if (0 < collisions)
|
||||
{
|
||||
if (0.209 <= collisions && 0.311 >= collisions)
|
||||
{
|
||||
myHelpers->log("joint/stripe on the right");
|
||||
helpers->log("joint/stripe on the right");
|
||||
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0;
|
||||
myTriggers->Sine(80, 80, percentForce);
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Sine(80, 80, percentForce);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
myHelpers->log("collision on the right");
|
||||
helpers->log("collision on the right");
|
||||
percentForce = (1.0 * collisions) * CollisionsStrength / 100.0;
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
}
|
||||
}
|
||||
else if (0 > collisions)
|
||||
{
|
||||
if (-0.209 >= collisions && -0.311 <= collisions)
|
||||
{
|
||||
myHelpers->log("joint/stripe on the left");
|
||||
helpers->log("joint/stripe on the left");
|
||||
percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0;
|
||||
myTriggers->Sine(80, 80, percentForce);
|
||||
myTriggers->Rumble(0, -1.0 * percentForce, 150);
|
||||
triggers->Sine(80, 80, percentForce);
|
||||
triggers->Rumble(0, -1.0 * percentForce, 150);
|
||||
}
|
||||
else
|
||||
{
|
||||
myHelpers->log("collision on the left");
|
||||
helpers->log("collision on the left");
|
||||
percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0;
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myHelpers->log("resetting collision");
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, 0);
|
||||
helpers->log("resetting collision");
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0);
|
||||
}
|
||||
|
||||
if (0 < tiresSlip)
|
||||
{
|
||||
myHelpers->log("tires slip left");
|
||||
helpers->log("tires slip left");
|
||||
bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
|
||||
percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
|
||||
myTriggers->Sine(100, 100, percentForce);
|
||||
triggers->Sine(100, 100, percentForce);
|
||||
|
||||
if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions)))
|
||||
{
|
||||
myTriggers->Rumble(0, -1.0 * percentForce, 150);
|
||||
triggers->Rumble(0, -1.0 * percentForce, 150);
|
||||
}
|
||||
}
|
||||
else if (0 > tiresSlip)
|
||||
{
|
||||
myHelpers->log("tires slip right");
|
||||
helpers->log("tires slip right");
|
||||
bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0);
|
||||
percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0;
|
||||
myTriggers->Sine(100, 100, percentForce);
|
||||
triggers->Sine(100, 100, percentForce);
|
||||
|
||||
if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions)))
|
||||
{
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
}
|
||||
}
|
||||
|
||||
INT_PTR ptr1 = myHelpers->ReadIntPtr(0x199A450, true);
|
||||
UINT8 gear = myHelpers->ReadByte(ptr1 + 0x398, false);
|
||||
INT_PTR ptr1 = helpers->ReadIntPtr(0x199A450, true);
|
||||
UINT8 gear = helpers->ReadByte(ptr1 + 0x398, false);
|
||||
|
||||
if (0 < WheelSpinStrength)
|
||||
{
|
||||
INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1948F10, true);
|
||||
INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x180 + 0xa8 + 0x18, false);
|
||||
UINT8 power = myHelpers->ReadByte(ptr2 + 0x98, false);
|
||||
int rpm = myHelpers->ReadInt32(0x1970038, true);
|
||||
int rpm = helpers->ReadInt32(0x1970038, true);
|
||||
int diff = 0x0A <= power ? 0 : 20;
|
||||
|
||||
if (
|
||||
@ -266,12 +266,12 @@ static int RunningThread(void* ptr)
|
||||
)
|
||||
{
|
||||
percentForce = (((100.0 - speed) / 100.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0;
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Sine(120, 120, percentForce);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
|
||||
msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed)
|
||||
+ " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce);
|
||||
myHelpers->log((char*)msg.c_str());
|
||||
helpers->log((char*)msg.c_str());
|
||||
}
|
||||
else if (
|
||||
2 == gear && 10 < speed && (
|
||||
@ -283,25 +283,25 @@ static int RunningThread(void* ptr)
|
||||
)
|
||||
{
|
||||
percentForce = (((160.0 - speed) / 150.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0;
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
myTriggers->Rumble(0, percentForce, 150);
|
||||
triggers->Sine(120, 120, percentForce);
|
||||
triggers->Rumble(0, percentForce, 150);
|
||||
|
||||
msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed)
|
||||
+ " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce);
|
||||
myHelpers->log((char*)msg.c_str());
|
||||
helpers->log((char*)msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < GearChangeStrength)
|
||||
{
|
||||
ptr1 = myHelpers->ReadIntPtr(0x199A468, true);
|
||||
float time = myHelpers->ReadFloat32(ptr1 + 0x18, false);
|
||||
ptr1 = helpers->ReadIntPtr(0x199A468, true);
|
||||
float time = helpers->ReadFloat32(ptr1 + 0x18, false);
|
||||
|
||||
if (oldgear != gear && 0 < gear && 0 < time)
|
||||
{
|
||||
msg = "oldgear: " + std::to_string(oldgear) + " | gear: " + std::to_string(gear)
|
||||
+ " | time: " + std::to_string(time) + " | speed: " + std::to_string(speed);
|
||||
myHelpers->log((char*)msg.c_str());
|
||||
helpers->log((char*)msg.c_str());
|
||||
}
|
||||
|
||||
if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed)
|
||||
@ -310,23 +310,4 @@ static int RunningThread(void* ptr)
|
||||
}
|
||||
oldgear = gear;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WMMT5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers){
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
#include "../Common Files/Game.h"
|
||||
class WMMT5 : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
@ -13,11 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "WackyRaces.h"
|
||||
#include "SDL.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
int ttx2wr(int ffRaw) {
|
||||
switch (ffRaw) {
|
||||
@ -88,16 +83,13 @@ int ttx2wr(int ffRaw) {
|
||||
}
|
||||
}
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
void WackyRaces::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
int ff = 0;
|
||||
|
||||
{
|
||||
long ffAddress = myHelpers->ReadInt32(0x7E00590, /* isRelativeOffset*/ true);
|
||||
int ffRaw = myHelpers->ReadInt32(ffAddress + 0x45, /* isRelativeOffset */ false);
|
||||
long ffAddress = helpers->ReadInt32(0x7E00590, /* isRelativeOffset*/ true);
|
||||
int ffRaw = helpers->ReadInt32(ffAddress + 0x45, /* isRelativeOffset */ false);
|
||||
int lampArray[7] = { 16, 1024, 512, 128, 8, 256, 16384 };
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if ((ffRaw & lampArray[i]) == lampArray[i]) {
|
||||
@ -107,39 +99,37 @@ static int RunningThread(void* ptr)
|
||||
ff = ttx2wr(ffRaw);
|
||||
}
|
||||
|
||||
//helpers->log("got value: ");
|
||||
//std::string ffs = std::to_string(ff);
|
||||
//helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (ff > 15)
|
||||
{
|
||||
myHelpers->log("moving wheel left");
|
||||
helpers->log("moving wheel left");
|
||||
// assume that 30 is the weakest and 16 is the strongest
|
||||
double percentForce = (31 - ff) / 15.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
// direction from left => makes wheel turn right
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 31 - ff
|
||||
lastWasStop = 0;
|
||||
}
|
||||
else if (ff > 0)
|
||||
{
|
||||
myHelpers->log("moving wheel right");
|
||||
helpers->log("moving wheel right");
|
||||
// assume that 1 is the strongest and 15 is the weakest
|
||||
double percentForce = (16 - ff) / 15.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
// direction from right => makes wheel turn left
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 15 - ff
|
||||
lastWasStop = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WackyRaces::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
else
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (lastWasStop == 0) {
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime
|
||||
lastWasStop = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "../Common Files/Game.h"
|
||||
|
||||
class WackyRaces : public Game {
|
||||
int lastWasStop = 0;
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
|
||||
|
Loading…
Reference in New Issue
Block a user