From 81288aca08040a48491b33519ebf42701cf4c6cf Mon Sep 17 00:00:00 2001 From: Aaron M Date: Sat, 2 Nov 2019 09:34:57 +1300 Subject: [PATCH] Revert2 --- Common Files/TeknoParrotGame.cpp | 17 + Common Files/TeknoParrotGame.h | 18 + Dinput8Wrapper.vcxproj | 2 + Dinput8Wrapper.vcxproj.filters | 4 + Game Files/AfterburnerClimax.cpp | 60 +- Game Files/BG4JP.cpp | 177 +- Game Files/BG4JP.h | 1 + Game Files/ChaseHQ2.cpp | 106 +- Game Files/ChaseHQ2.h | 1 + Game Files/Daytona3.cpp | 6 - Game Files/Daytona3.h | 1 + Game Files/Demul.cpp | 121 +- Game Files/FordRacing.cpp | 100 +- Game Files/FordRacing.h | 5 +- Game Files/FordRacingOther.cpp | 47 +- Game Files/GRID.cpp | 10 + Game Files/GTIClub3.cpp | 147 +- Game Files/HOTD4.cpp | 8 +- Game Files/InitialD4.cpp | 160 +- Game Files/InitialD4Japan.cpp | 161 +- Game Files/InitialD5.cpp | 160 +- Game Files/InitialD6.cpp | 161 +- Game Files/InitialD6.h | 5 +- Game Files/InitialD7.cpp | 161 +- Game Files/InitialD7.h | 5 +- Game Files/InitialD8.cpp | 161 +- Game Files/InitialD8.h | 5 +- Game Files/KODrive.cpp | 129 +- Game Files/LGI.cpp | 437 +- Game Files/LGI3D.cpp | 602 +- Game Files/M2Emulator.cpp | 6943 ++++++++++++++++++++---- Game Files/Machstorm.cpp | 325 +- Game Files/Machstorm.h | 1 + Game Files/Mame0199.cpp | 3042 +++++------ Game Files/Mame0206.cpp | 2930 +++++----- Game Files/MarioKartGPDX.cpp | 218 +- Game Files/MarioKartGPDX.h | 1 + Game Files/MarioKartGPDX1.10.cpp | 398 +- Game Files/MarioKartGPDX1.10.h | 1 + Game Files/OutRun2Fake.cpp | 6 - Game Files/OutRun2Real.cpp | 28 +- Game Files/PokkenTournament.cpp | 111 +- Game Files/PokkenTournament.h | 1 + Game Files/RoadFighters3D.cpp | 4 - Game Files/SegaRacingClassic.cpp | 200 +- Game Files/SegaRacingClassic.h | 1 + Game Files/SegaRally3.cpp | 97 +- Game Files/SegaRally3.h | 5 +- Game Files/SonicSegaAllStarsRacing.cpp | 90 +- Game Files/SonicSegaAllStarsRacing.h | 1 + Game Files/TestGame.h | 1 + Game Files/WMMT5.cpp | 357 +- Game Files/WMMT5.h | 1 + Game Files/WackyRaces.cpp | 98 +- Game Files/WackyRaces.h | 1 + 55 files changed, 11132 insertions(+), 6707 deletions(-) create mode 100644 Common Files/TeknoParrotGame.cpp create mode 100644 Common Files/TeknoParrotGame.h diff --git a/Common Files/TeknoParrotGame.cpp b/Common Files/TeknoParrotGame.cpp new file mode 100644 index 0000000..b7a2983 --- /dev/null +++ b/Common Files/TeknoParrotGame.cpp @@ -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"); +} \ No newline at end of file diff --git a/Common Files/TeknoParrotGame.h b/Common Files/TeknoParrotGame.h new file mode 100644 index 0000000..301dbbf --- /dev/null +++ b/Common Files/TeknoParrotGame.h @@ -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); +}; \ No newline at end of file diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index 7651ece..5346411 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -50,6 +50,7 @@ + @@ -85,6 +86,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 0e9ce44..453eca2 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -47,6 +47,7 @@ Game Files + Game Files @@ -151,6 +152,9 @@ Game Files + + Common Header Files + Game Files diff --git a/Game Files/AfterburnerClimax.cpp b/Game Files/AfterburnerClimax.cpp index 2d18874..f356537 100644 --- a/Game Files/AfterburnerClimax.cpp +++ b/Game Files/AfterburnerClimax.cpp @@ -14,57 +14,29 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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); + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); -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: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff == 64) + 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) + else if (ff == 80) { double percentForce = ((Rumble2Strength) / 100.0); double percentLength = (Rumble2Length); - myTriggers->Rumble(percentForce, percentForce, percentLength); + triggers->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; - } } \ No newline at end of file diff --git a/Game Files/BG4JP.cpp b/Game Files/BG4JP.cpp index bac176f..d8230b0 100644 --- a/Game Files/BG4JP.cpp +++ b/Game Files/BG4JP.cpp @@ -13,110 +13,83 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "BG4JP.h" -#include "SDL.h" -static SDL_Event e; -static EffectTriggers* myTriggers; -static EffectConstants* myConstants; -static Helpers* myHelpers; static int SpeedStrength; - -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); - if ((ffspeed >= 0.1) & (ffspeed <= 15)) - { - SpeedStrength = 10; - } - else if ((ffspeed >= 15.01) & (ffspeed <= 35)) - { - SpeedStrength = 20; - } - else if ((ffspeed >= 35.01) & (ffspeed <= 55)) - { - SpeedStrength = 30; - } - else if ((ffspeed >= 55.01) & (ffspeed <= 75)) - { - SpeedStrength = 40; - } - else if ((ffspeed >= 75.01) & (ffspeed <= 90)) - { - SpeedStrength = 51; - } - else if ((ffspeed >= 90.01) & (ffspeed <= 110)) - { - SpeedStrength = 62; - } - else if ((ffspeed >= 110.01) & (ffspeed <= 130)) - { - SpeedStrength = 75; - } - else if ((ffspeed >= 130.01) & (ffspeed <= 150)) - { - SpeedStrength = 90; - } - else if (ffspeed > 150.01) - { - SpeedStrength = 100; - } - else - { - SpeedStrength = 0; - } - - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff); - myHelpers->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); - } - 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); - } - 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); - } - 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) + 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)) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + SpeedStrength = 10; + } + else if ((ffspeed >= 15.01) & (ffspeed <= 35)) + { + SpeedStrength = 20; + } + else if ((ffspeed >= 35.01) & (ffspeed <= 55)) + { + SpeedStrength = 30; + } + else if ((ffspeed >= 55.01) & (ffspeed <= 75)) + { + SpeedStrength = 40; + } + else if ((ffspeed >= 75.01) & (ffspeed <= 90)) + { + SpeedStrength = 51; + } + else if ((ffspeed >= 90.01) & (ffspeed <= 110)) + { + SpeedStrength = 62; + } + else if ((ffspeed >= 110.01) & (ffspeed <= 130)) + { + SpeedStrength = 75; + } + else if ((ffspeed >= 130.01) & (ffspeed <= 150)) + { + SpeedStrength = 90; + } + else if (ffspeed > 150.01) + { + SpeedStrength = 100; + } + else + { + SpeedStrength = 0; + } + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((2000000 < ff) && (ff < 4000000)) + { + double percentForce = SpeedStrength / 100.0; + double percentLength = 150; + 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; + 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); + 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); + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } } \ No newline at end of file diff --git a/Game Files/BG4JP.h b/Game Files/BG4JP.h index 225de54..ef57e13 100644 --- a/Game Files/BG4JP.h +++ b/Game Files/BG4JP.h @@ -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); diff --git a/Game Files/ChaseHQ2.cpp b/Game Files/ChaseHQ2.cpp index 5a7fe74..5d4bf58 100644 --- a/Game Files/ChaseHQ2.cpp +++ b/Game Files/ChaseHQ2.cpp @@ -13,15 +13,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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,61 +85,53 @@ int ttx2chasehq2(int ffRaw) { } } -static int RunningThread(void* ptr) -{ - int cnt; - for (cnt = 0; cnt >= 0; ++cnt) - { - 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 }; - for (int i = 0; i < 7; i++) { - if ((ffRaw & lampArray[i]) == lampArray[i]) { - ffRaw -= lampArray[i]; - } - }; - - ff = ttx2chasehq2(ffRaw); - } - - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff > 15) - { - myHelpers->log("moving wheel right"); - double percentForce = (31 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if (ff > 0) - { - myHelpers->log("moving wheel left"); - double percentForce = (16 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } -} - 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) + int ff = 0; { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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]; + } + }; + + ff = ttx2chasehq2(ffRaw); + } + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if (ff > 15) + { + helpers->log("moving wheel right"); + // assume that 30 is the weakest and 16 is the strongest + double percentForce = (31 - ff) / 15.0; + double percentLength = 100; + // direction from left => makes wheel turn right + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff + lastWasStop = 0; + } + else if (ff > 0) + { + helpers->log("moving wheel left"); + // assume that 1 is the strongest and 15 is the weakest + double percentForce = (16 - ff) / 15.0; + double percentLength = 100; + // direction from right => makes wheel turn left + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } } } \ No newline at end of file diff --git a/Game Files/ChaseHQ2.h b/Game Files/ChaseHQ2.h index c68a097..9ca48c2 100644 --- a/Game Files/ChaseHQ2.h +++ b/Game Files/ChaseHQ2.h @@ -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); diff --git a/Game Files/Daytona3.cpp b/Game Files/Daytona3.cpp index 0bb1444..cdf157f 100644 --- a/Game Files/Daytona3.cpp +++ b/Game Files/Daytona3.cpp @@ -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: "); diff --git a/Game Files/Daytona3.h b/Game Files/Daytona3.h index a7befbf..05a06c2 100644 --- a/Game Files/Daytona3.h +++ b/Game Files/Daytona3.h @@ -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); diff --git a/Game Files/Demul.cpp b/Game Files/Demul.cpp index d7d43d2..6a7a18a 100644 --- a/Game Files/Demul.cpp +++ b/Game Files/Demul.cpp @@ -18,12 +18,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include #include -#include "SDL.h" - -static SDL_Event e; -static EffectTriggers* myTriggers; -static EffectConstants* myConstants; -static Helpers* myHelpers; int nascar(int ffnas) { switch (ffnas) { @@ -116,84 +110,65 @@ 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"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + { - const TCHAR substring[] = TEXT("NASCAR"); - EnumWindows(FindWindowBySubstr, (LPARAM)substring); - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - + int ffnascar = 0; { - int ffnascar = 0; + if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring)) { - if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring)) - { - UINT8 ffnas = myHelpers->ReadByte(0x30060C, /* isRelativeOffset */ true); //Nascar Arcade - std::string ffs = std::to_string(ffnas); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffnascar = nascar(ffnas); + UINT8 ffnas = helpers->ReadByte(0x30060C, /* isRelativeOffset */ true); //Nascar Arcade + std::string ffs = std::to_string(ffnas); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffnascar = nascar(ffnas); - if (FFBMode == 0) + if (FFBMode == 0) + { + if ((ffnascar > 16) & (ffnascar < 33)) { - if ((ffnascar > 16)& (ffnascar < 33)) - { - myHelpers->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); - } - else if ((ffnascar > 0)& (ffnascar < 17)) - { - myHelpers->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); - } + helpers->log("moving wheel left"); + double percentForce = (ffnascar - 16) / 16.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - else + else if ((ffnascar > 0) & (ffnascar < 17)) { - if ((ffnascar > 16)& (ffnascar < 33)) - { - myHelpers->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))); - } - else if ((ffnascar > 0)& (ffnascar < 17)) - { - myHelpers->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))); - } + helpers->log("moving wheel right"); + double percentForce = (17 - ffnascar) / 16.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffnascar > 16) & (ffnascar < 33)) + { + helpers->log("moving wheel left"); + double percentForce = (ffnascar - 16) / 16.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffnascar > 0) & (ffnascar < 17)) + { + helpers->log("moving wheel right"); + double percentForce = (17 - ffnascar) / 16.0; + double percentLength = 100; + 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; - } -} \ No newline at end of file diff --git a/Game Files/FordRacing.cpp b/Game Files/FordRacing.cpp index d9b8661..4c08fb2 100644 --- a/Game Files/FordRacing.cpp +++ b/Game Files/FordRacing.cpp @@ -13,73 +13,43 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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; -} +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); + helpers->log((char *)ffs.c_str()); -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"); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff < -65505 && ff > -65515) - { - myHelpers->log("moving wheel left"); - double percentForce = (-65505 - ff) / 9.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if (ff > 0 && ff < 16) - { - myHelpers->log("moving wheel right"); - double percentForce = (16 - ff) / 9.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } -} - -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) + if (ff < -65505 && ff > -65515) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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 = 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) + { + 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 = 50; + // direction from right => makes wheel turn left + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } } } \ No newline at end of file diff --git a/Game Files/FordRacing.h b/Game Files/FordRacing.h index 7438486..539ab18 100644 --- a/Game Files/FordRacing.h +++ b/Game Files/FordRacing.h @@ -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); }; \ No newline at end of file diff --git a/Game Files/FordRacingOther.cpp b/Game Files/FordRacingOther.cpp index 9d0585a..69bd229 100644 --- a/Game Files/FordRacingOther.cpp +++ b/Game Files/FordRacingOther.cpp @@ -13,11 +13,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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,44 +64,24 @@ 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) { - HMODULE hMod = GetModuleHandleA("inpout32.dll"); - if (hMod) + if (!init) { - if (!init) - { - int hookLength = 6; - DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32"); - if (hookAddress) - { - jmpBackAddy = hookAddress + hookLength; - Hook((void*)hookAddress, Out32, hookLength); - init = true; - } - + int hookLength = 6; + DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32"); + if (hookAddress) + { + jmpBackAddy = hookAddress + hookLength; + Hook((void*)hookAddress, Out32, hookLength); + init = true; } + } } - 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; - } } \ No newline at end of file diff --git a/Game Files/GRID.cpp b/Game Files/GRID.cpp index 3c34c88..3fe8b7f 100644 --- a/Game Files/GRID.cpp +++ b/Game Files/GRID.cpp @@ -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 } \ No newline at end of file diff --git a/Game Files/GTIClub3.cpp b/Game Files/GTIClub3.cpp index 982fea9..11947e6 100644 --- a/Game Files/GTIClub3.cpp +++ b/Game Files/GTIClub3.cpp @@ -14,95 +14,68 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - 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: "); - std::string ffs = std::to_string(ff2); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 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); - } - if ((ff > 0x80)& (ff < 0x101)& (menu == 0)) - { - myHelpers->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); - } - else if ((ff > 0x00)& (ff < 0x80)& (menu == 0)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff) / 127.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - 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)); - } - if ((ff > 0x80)& (ff < 0x101)& (menu == 0)) - { - myHelpers->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))); - } - else if ((ff > 0x00)& (ff < 0x80)& (menu == 0)) - { - myHelpers->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))); - } - } - } -} 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 = 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); + helpers->log((char *)ffs.c_str()); - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (FFBMode == 0) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + if ((ff1 > 0x00) & (ff1 < 0x40) & (menu == 0)) + { + double percentForce = (ff1) / 63.0; + double percentLength = 100; + triggers->Rumble(percentForce, percentForce, percentLength); + triggers->Sine(120, 120, percentForce); + } + if ((ff > 0x80) & (ff < 0x101) & (menu == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (257 - ff) / 128.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x00) & (ff < 0x80) & (menu == 0)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 127.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff1 > 0x00) & (ff1 < 0x40) & (menu == 0)) + { + double percentForce = (ff1) / 63.0; + double percentLength = 100; + 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)) + { + helpers->log("moving wheel right"); + double percentForce = (257 - ff) / 128.0; + double percentLength = 100; + 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)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 127.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } } \ No newline at end of file diff --git a/Game Files/HOTD4.cpp b/Game Files/HOTD4.cpp index c96ef58..f2c4637 100644 --- a/Game Files/HOTD4.cpp +++ b/Game Files/HOTD4.cpp @@ -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; } \ No newline at end of file diff --git a/Game Files/InitialD4.cpp b/Game Files/InitialD4.cpp index e424c28..9dc8f69 100644 --- a/Game Files/InitialD4.cpp +++ b/Game Files/InitialD4.cpp @@ -14,102 +14,78 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - 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: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff2 == 0x86) - { - myTriggers->Spring(0.8); - } - if (ff2 == 0x85) //cars colliding or rubbing against wall etc - { - if (ff1 > 0) - { - double percentLength = 200; - double percentForce = (0.6); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - } - if (FFBMode == 1) - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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))); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->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))); - } - } - } - else - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff) / 72.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - } - } -} void InitialD4::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers){ - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + 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); + helpers->log((char *)ffs.c_str()); - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (ff2 == 0x86) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + triggers->Spring(0.8); + } + if (ff2 == 0x85) //cars colliding or rubbing against wall etc + { + if (ff1 > 0) + { + double percentLength = 200; + double percentForce = (0.6); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + } + if (FFBMode == 1) + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 55) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + double powforce = (73 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); + } + } + } + else + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } } } \ No newline at end of file diff --git a/Game Files/InitialD4Japan.cpp b/Game Files/InitialD4Japan.cpp index e57ac83..08ddffe 100644 --- a/Game Files/InitialD4Japan.cpp +++ b/Game Files/InitialD4Japan.cpp @@ -14,102 +14,77 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - 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: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff2 == 0x86) - { - myTriggers->Spring(0.8); - } - if (ff2 == 0x85) //cars colliding or rubbing against wall etc - { - if (ff1 > 0) - { - double percentLength = 200; - double percentForce = (0.6); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - } - if (FFBMode == 1) - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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))); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->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))); - } - } - } - else - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff) / 72.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - } - } -} 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 = 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); + helpers->log((char *)ffs.c_str()); - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (ff2 == 0x86) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + triggers->Spring(0.8); + } + if (ff2 == 0x85) //cars colliding or rubbing against wall etc + { + if (ff1 > 0) + { + double percentLength = 200; + double percentForce = (0.6); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + } + if (FFBMode == 1) + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 55) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + double powforce = (73 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); + } + } + } + else + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } } } \ No newline at end of file diff --git a/Game Files/InitialD5.cpp b/Game Files/InitialD5.cpp index c659364..4c057de 100644 --- a/Game Files/InitialD5.cpp +++ b/Game Files/InitialD5.cpp @@ -14,102 +14,78 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - 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: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff2 == 0x86) - { - myTriggers->Spring(0.8); - } - if (ff2 == 0x85) //cars colliding or rubbing against wall etc - { - if (ff1 > 0) - { - double percentLength = 200; - double percentForce = (0.6); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - } - if (FFBMode == 1) - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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))); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->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))); - } - } - } - else - { - if (ff2 == 0x84) - { - if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) - { - myHelpers->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); - } - else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff) / 72.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - } - } -} void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + 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); + helpers->log((char *)ffs.c_str()); - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (ff2 == 0x86) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + triggers->Spring(0.8); + } + if (ff2 == 0x85) //cars colliding or rubbing against wall etc + { + if (ff1 > 0) + { + double percentLength = 200; + double percentForce = (0.6); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + } + if (FFBMode == 1) + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 55) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + double powforce = (73 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); + } + } + } + else + { + if (ff2 == 0x84) + { + if ((ff > 0x37) && (ff < 0x80) && (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) && (ff < 0x49) && (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 72.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } } } \ No newline at end of file diff --git a/Game Files/InitialD6.cpp b/Game Files/InitialD6.cpp index 927a86e..f7091c3 100644 --- a/Game Files/InitialD6.cpp +++ b/Game Files/InitialD6.cpp @@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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; { - int ffrubbingwalls = 0; - int ffcarcollision = 0; - { - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - myHelpers->log("in ID6 Ffbloop"); - const int ff = GetTeknoParrotFFB(); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - ffcarcollision = carscollide(ff); - ffrubbingwalls = rubbingwalls(ff); + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + helpers->log("in ID6 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + ffcarcollision = carscollide(ff); + ffrubbingwalls = rubbingwalls(ff); - if (ff == 0x60000) + if (ff == 0x60000) + { + triggers->Spring(0.8); + } + if (ffrubbingwalls > 0) // car rubbing against wall + { + double percentLength = 200; + double percentForce = (ffrubbingwalls / 31.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (ffcarcollision > 0) //cars colliding or rubbing with each other + { + double percentLength = 200; + double percentForce = (ffcarcollision / 16.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (FFBMode == 1) + { + if ((ff > 0x40037) & (ff < 0x40080)) { - myTriggers->Spring(0.8); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 262199) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); } - if (ffrubbingwalls > 0) // car rubbing against wall + else if ((ff > 0x40100) & (ff < 0x40149)) { - double percentLength = 200; - double percentForce = (ffrubbingwalls / 31.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + double powforce = (262473 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); } - if (ffcarcollision > 0) //cars colliding or rubbing with each other + } + else + { + if ((ff > 0x40037) & (ff < 0x40080)) { - double percentLength = 200; - double percentForce = (ffcarcollision / 16.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - if (FFBMode == 1) + else if ((ff > 0x40100) & (ff < 0x40149)) { - 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))); - } - 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))); - } - } - else - { - 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); - } - 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); - } + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + 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; - } } \ No newline at end of file diff --git a/Game Files/InitialD6.h b/Game Files/InitialD6.h index 89b80ab..5962416 100644 --- a/Game Files/InitialD6.h +++ b/Game Files/InitialD6.h @@ -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); }; \ No newline at end of file diff --git a/Game Files/InitialD7.cpp b/Game Files/InitialD7.cpp index a95c204..a5db945 100644 --- a/Game Files/InitialD7.cpp +++ b/Game Files/InitialD7.cpp @@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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; { - int ffrubbingwalls = 0; - int ffcarcollision = 0; - { - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - myHelpers->log("in ID6 Ffbloop"); - const int ff = GetTeknoParrotFFB(); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - ffcarcollision = carscollide(ff); - ffrubbingwalls = rubbingwalls(ff); + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + helpers->log("in ID7 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + ffcarcollision = carscollide(ff); + ffrubbingwalls = rubbingwalls(ff); - if (ff == 0x60000) + if (ff == 0x60000) + { + triggers->Spring(0.8); + } + if (ffrubbingwalls > 0) // car rubbing against wall + { + double percentLength = 200; + double percentForce = (ffrubbingwalls / 31.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (ffcarcollision > 0) //cars colliding or rubbing with each other + { + double percentLength = 200; + double percentForce = (ffcarcollision / 16.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (FFBMode == 1) + { + if ((ff > 0x40037) & (ff < 0x40080)) { - myTriggers->Spring(0.8); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 262199) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); } - if (ffrubbingwalls > 0) // car rubbing against wall + else if ((ff > 0x40100) & (ff < 0x40149)) { - double percentLength = 200; - double percentForce = (ffrubbingwalls / 31.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + double powforce = (262473 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); } - if (ffcarcollision > 0) //cars colliding or rubbing with each other + } + else + { + if ((ff > 0x40037) & (ff < 0x40080)) { - double percentLength = 200; - double percentForce = (ffcarcollision / 16.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - if (FFBMode == 1) + else if ((ff > 0x40100) & (ff < 0x40149)) { - 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))); - } - 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))); - } - } - else - { - 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); - } - 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); - } + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + 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; - } } \ No newline at end of file diff --git a/Game Files/InitialD7.h b/Game Files/InitialD7.h index 8842387..9e8e399 100644 --- a/Game Files/InitialD7.h +++ b/Game Files/InitialD7.h @@ -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); }; \ No newline at end of file diff --git a/Game Files/InitialD8.cpp b/Game Files/InitialD8.cpp index 41ce3e7..40f4c51 100644 --- a/Game Files/InitialD8.cpp +++ b/Game Files/InitialD8.cpp @@ -13,14 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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; { - int ffrubbingwalls = 0; - int ffcarcollision = 0; - { - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - myHelpers->log("in ID6 Ffbloop"); - const int ff = GetTeknoParrotFFB(); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - ffcarcollision = carscollide(ff); - ffrubbingwalls = rubbingwalls(ff); + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + helpers->log("in ID8 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + ffcarcollision = carscollide(ff); + ffrubbingwalls = rubbingwalls(ff); - if (ff == 0x60000) + if (ff == 0x60000) + { + triggers->Spring(0.8); + } + if (ffrubbingwalls > 0) // car rubbing against wall + { + double percentLength = 200; + double percentForce = (ffrubbingwalls / 31.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (ffcarcollision > 0) //cars colliding or rubbing with each other + { + double percentLength = 200; + double percentForce = (ffcarcollision / 16.0); + triggers->Inertia(percentForce); + triggers->Friction(percentForce); + triggers->Damper(percentForce); + triggers->Rumble(percentForce, percentForce, percentLength); + } + if (FFBMode == 1) + { + if ((ff > 0x40037) & (ff < 0x40080)) { - myTriggers->Spring(0.8); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + double powforce = (ff - 262199) / 72.0; + triggers->Rumble(pow(percentForce, powforce), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, powforce))); } - if (ffrubbingwalls > 0) // car rubbing against wall + else if ((ff > 0x40100) & (ff < 0x40149)) { - double percentLength = 200; - double percentForce = (ffrubbingwalls / 31.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + double powforce = (262473 - ff) / 72.0; + triggers->Rumble(0, pow(percentForce, powforce), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, powforce))); } - if (ffcarcollision > 0) //cars colliding or rubbing with each other + } + else + { + if ((ff > 0x40037) & (ff < 0x40080)) { - double percentLength = 200; - double percentForce = (ffcarcollision / 16.0); - myTriggers->Friction(percentForce); - myTriggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (262272 - ff) / 72.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } - if (FFBMode == 1) + else if ((ff > 0x40100) & (ff < 0x40149)) { - 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))); - } - 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))); - } - } - else - { - 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); - } - 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); - } + double percentForce = (ff - 262400) / 72.0; + double percentLength = 100; + 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; - } } \ No newline at end of file diff --git a/Game Files/InitialD8.h b/Game Files/InitialD8.h index ed74d8f..8b24876 100644 --- a/Game Files/InitialD8.h +++ b/Game Files/InitialD8.h @@ -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); }; \ No newline at end of file diff --git a/Game Files/KODrive.cpp b/Game Files/KODrive.cpp index 73b04cf..90abe0b 100644 --- a/Game Files/KODrive.cpp +++ b/Game Files/KODrive.cpp @@ -13,87 +13,60 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if ((ff == 10) & (ff1 == 30)) - { - double percentForce = 0.4; - double percentForce1 = 1.0; - double percentLength = 100; - myTriggers->Rumble(percentForce1, percentForce1, percentLength); - myTriggers->Sine(80, 80, percentForce); - } - if (FFBMode == 1) - { - if ((ff > 0x66)& (ff < 0x80)& (ff1 == 0)) - { - myHelpers->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))); - } - else if ((ff > 0x00)& (ff < 0x19)& (ff1 == 1)) - { - myHelpers->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))); - } - } - else - { - if ((ff > 0x66)& (ff < 0x80)& (ff1 == 0)) - { - myHelpers->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); - } - else if ((ff > 0x00)& (ff < 0x19)& (ff1 == 1)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff) / 24.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - } -} 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); + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if ((ff == 10) & (ff1 == 30)) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + double percentForce = 0.4; + double percentForce1 = 2.7; + double percentLength = 100; + triggers->Rumble(percentForce1, percentForce1, percentLength); + triggers->Sine(80, 80, percentForce); } + if (FFBMode == 1) + { + if ((ff > 0x66) & (ff < 0x80) & (ff1 == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 24.0; + double percentLength = 100; + 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)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 24.0; + double percentLength = 100; + 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)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 24.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) & (ff < 0x19) & (ff1 == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 24.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } } \ No newline at end of file diff --git a/Game Files/LGI.cpp b/Game Files/LGI.cpp index 89cb169..baa8022 100644 --- a/Game Files/LGI.cpp +++ b/Game Files/LGI.cpp @@ -15,242 +15,44 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "LGI.h" #include "SDL.h" #include -#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: "); - std::string ffs = std::to_string(ff1); - myHelpers->log((char*)ffs.c_str()); - float static oldFloat1 = 0.0; - float static oldFloat2 = 0.0; - float newFloat1 = health1p; - float newFloat2 = health2p; - - 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); - int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename); - int Knock1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock1pStrength"), 0, settingsFilename); - int Motor1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor1pStrength"), 0, settingsFilename); - int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename); - int Knock2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock2pStrength"), 0, settingsFilename); - 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) { + 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); + helpers->log((char *)ffs.c_str()); + float static oldFloat1 = 0.0; + float static oldFloat2 = 0.0; + float newFloat1 = health1p; + float newFloat2 = health2p; - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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); + int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename); + int Knock1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock1pStrength"), 0, settingsFilename); + int Motor1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor1pStrength"), 0, settingsFilename); + int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename); + int Knock2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock2pStrength"), 0, settingsFilename); + int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename); + int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename); 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) - { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + if ((oldFloat1 != newFloat1) && (health1p != 0x1)) + { + 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; } \ No newline at end of file diff --git a/Game Files/LGI3D.cpp b/Game Files/LGI3D.cpp index b82e887..b8e81be 100644 --- a/Game Files/LGI3D.cpp +++ b/Game Files/LGI3D.cpp @@ -15,324 +15,45 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "LGI3D.h" #include "SDL.h" #include -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"); - -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: "); - std::string ffs = std::to_string(ff1); - myHelpers->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); - int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename); - int Knock1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock1pStrength"), 0, settingsFilename); - int Motor1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor1pStrength"), 0, settingsFilename); - int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename); - int Knock2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock2pStrength"), 0, settingsFilename); - 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) { + + 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); + helpers->log((char *)ffs.c_str()); + float static oldFloat1 = 0.0; + float static oldFloat2 = 0.0; + float newFloat1 = health1p; + float newFloat2 = health2p; - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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); + int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename); + int Knock1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock1pStrength"), 0, settingsFilename); + int Motor1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor1pStrength"), 0, settingsFilename); + int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename); + int Knock2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Knock2pStrength"), 0, settingsFilename); + int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename); + int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename); 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; } \ No newline at end of file diff --git a/Game Files/M2Emulator.cpp b/Game Files/M2Emulator.cpp index 6b2facd..db7a7cf 100644 --- a/Game Files/M2Emulator.cpp +++ b/Game Files/M2Emulator.cpp @@ -17,13 +17,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "math.h" #include "SDL.h" -static EffectTriggers* myTriggers; -static EffectConstants* myConstants; -static Helpers* myHelpers; -static SDL_Event e; - -static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - static bool init = false; static bool __stdcall ExitHook(UINT uExitCode) @@ -32,7 +25,7 @@ static bool __stdcall ExitHook(UINT uExitCode) return 0; } -static bool Hook(void* toHook, void* ourFunct, int len) { +static bool Hook(void * toHook, void * ourFunct, int len) { if (len < 5) { return false; } @@ -55,780 +48,683 @@ 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 M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) { + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + int DaytonaAIMultiplayerHack = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaAIMultiplayerHack"), 0, settingsFilename); + int DaytonaForcePanoramicAttract = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaForcePanoramicAttract"), 0, settingsFilename); + + HWND hWnd1 = FindWindowA(0, ("Sega Rally Championship")); + HWND hWnd2 = FindWindowA(0, ("Daytona USA")); + HWND hWnd3 = FindWindowA(0, ("Indianapolis 500 (Rev A, Deluxe)")); + HWND hWnd4 = FindWindowA(0, ("Sega Touring Car Championship (Rev A)")); + HWND hWnd5 = FindWindowA(0, ("Over Rev")); + HWND hWnd6 = FindWindowA(0, ("Super GT 24h")); + HWND hWnd7 = FindWindowA(0, ("Daytona USA '93 Edition")); + HWND hWnd8 = FindWindowA(0, ("Daytona USA (Saturn Ads)")); + HWND hWnd9 = FindWindowA(0, ("Daytona USA Special Edition")); + HWND hWnd10 = FindWindowA(0, ("Daytona USA Turbo")); + HWND hWnd11 = FindWindowA(0, ("Daytona USA Turbo (Rev A)")); + HWND hWnd12 = FindWindowA(0, ("Daytona USA: GTX 2004")); + HWND hWnd13 = FindWindowA(0, ("Daytona USA: To The Maxx")); + HWND hWnd14 = FindWindowA(0, ("Sega Rally Championship (Rev B)")); + HWND hWnd15 = FindWindowA(0, ("Sega Rally Pro Drivin'")); + HWND hWnd16 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Newer rev)")); + HWND hWnd17 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Older rev)")); + HWND hWnd18 = FindWindowA(0, ("Sega Touring Car Championship")); + HWND hWnd19 = FindWindowA(0, ("Sega Touring Car Championship (Rev B)")); + HWND hWnd20 = FindWindowA(0, ("Over Rev (Model 2B)")); + + + HMODULE hMod = GetModuleHandleA("KERNEL32.dll"); + if (hMod) { - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - int DaytonaAIMultiplayerHack = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaAIMultiplayerHack"), 0, settingsFilename); - int DaytonaForcePanoramicAttract = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaForcePanoramicAttract"), 0, settingsFilename); - - HWND hWnd1 = FindWindowA(0, ("Sega Rally Championship")); - HWND hWnd2 = FindWindowA(0, ("Daytona USA")); - HWND hWnd3 = FindWindowA(0, ("Indianapolis 500 (Rev A, Deluxe)")); - HWND hWnd4 = FindWindowA(0, ("Sega Touring Car Championship (Rev A)")); - HWND hWnd5 = FindWindowA(0, ("Over Rev")); - HWND hWnd6 = FindWindowA(0, ("Super GT 24h")); - HWND hWnd7 = FindWindowA(0, ("Daytona USA '93 Edition")); - HWND hWnd8 = FindWindowA(0, ("Daytona USA (Saturn Ads)")); - HWND hWnd9 = FindWindowA(0, ("Daytona USA Special Edition")); - HWND hWnd10 = FindWindowA(0, ("Daytona USA Turbo")); - HWND hWnd11 = FindWindowA(0, ("Daytona USA Turbo (Rev A)")); - HWND hWnd12 = FindWindowA(0, ("Daytona USA: GTX 2004")); - HWND hWnd13 = FindWindowA(0, ("Daytona USA: To The Maxx")); - HWND hWnd14 = FindWindowA(0, ("Sega Rally Championship (Rev B)")); - HWND hWnd15 = FindWindowA(0, ("Sega Rally Pro Drivin'")); - HWND hWnd16 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Newer rev)")); - HWND hWnd17 = FindWindowA(0, ("Indianapolis 500 (Rev A, Twin, Older rev)")); - HWND hWnd18 = FindWindowA(0, ("Sega Touring Car Championship")); - HWND hWnd19 = FindWindowA(0, ("Sega Touring Car Championship (Rev B)")); - HWND hWnd20 = FindWindowA(0, ("Over Rev (Model 2B)")); - - - HMODULE hMod = GetModuleHandleA("KERNEL32.dll"); - if (hMod) + if (!init) { - if (!init) + int hookLength = 6; + DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"KERNEL32.dll"), "ExitProcess"); + if (hookAddress) { - int hookLength = 6; - DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"KERNEL32.dll"), "ExitProcess"); - if (hookAddress) + jmpBackAddy = hookAddress + hookLength; + Hook((void*)hookAddress, ExitHook, hookLength); + init = true; + } + } + } + + if (hWnd1 > NULL) + { + UINT8 ff = helpers->ReadByte(0x174CF4, /* isRelativeOffset*/ true); //SegaRallyChampionship + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd2 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) { - jmpBackAddy = hookAddress + hookLength; - Hook((void*)hookAddress, ExitHook, hookLength); - init = true; + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } } } } - if (hWnd1 > NULL) - { - UINT8 ff = myHelpers->ReadByte(0x174CF4, /* isRelativeOffset*/ true); //SegaRallyChampionship - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - if (FFBMode == 0) - { - if ((ff > 0xBF)& (ff < 0xDF)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff - 191) / 31.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff > 0x7F)& (ff < 0x9F)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff - 127) / 31.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff > 0xBF)& (ff < 0xDF)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ff - 191) / 31.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff > 0x7F)& (ff < 0x9F)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff - 127) / 31.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - else if (hWnd2 > NULL) - { - if (DaytonaForcePanoramicAttract == 1) - { - INT_PTR Rambase = myHelpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); - INT_PTR Rambase1 = myHelpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); - } - - if (DaytonaAIMultiplayerHack == 1) - { - INT_PTR Rambase = myHelpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); - INT_PTR Rambase1 = myHelpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); - UINT8 gamestate = myHelpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); - UINT8 track = myHelpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); - UINT8 trackselect = myHelpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); - UINT8 countdown = myHelpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); - UINT8 linksize = myHelpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); - UINT8 linkID = myHelpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); - INT_PTR gamestatetimer = myHelpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); - UINT8 camhack = myHelpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); - UINT8 carsinfront = myHelpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); - UINT8 mpposition = myHelpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); - float cary = myHelpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); - float carx = myHelpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); - UINT8 nop1 = myHelpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); - UINT8 nop2 = myHelpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); - UINT8 nop3 = myHelpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); - - - if (gamestate == 0x1A) - { - myHelpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); - } - - if (trackselect == 0x01) - { - myHelpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); - } - else if (trackselect == 0x02) - { - myHelpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); - } - - if (linksize == 0x02) - { - if (linkID == 0x02) - { - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(150); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - } - else if (linkID == 0x01) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - } - } - else if (linksize == 0x03) - { - if (linkID == 0x03) - { - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(250); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - } - else if (linkID == 0x02) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(150); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - } - else if (linkID == 0x01) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - } - } - else if (linksize == 0x04) - { - if (linkID == 0x04) - { - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(250); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - } - if (linkID == 0x03) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(350); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - } - else if (linkID == 0x02) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - Sleep(150); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - } - else if (linkID == 0x01) - { - if ((gamestate == 0x1A) & (gamestatetimer < 100)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - else if ((gamestate == 0x1A) & (gamestatetimer > 100)) - { - Sleep(100); - myHelpers->WriteNop(0xC2130, true); - myHelpers->WriteNop(0xC2131, true); - myHelpers->WriteNop(0xC2132, true); - } - - if ((gamestate > 0x1A)& (gamestate < 0x1A)) - { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); - } - - if (gamestate > 0x07) - { - myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); - myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); - } - if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) - { - myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); - } - if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - myHelpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) - { - myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race - Sleep(50); - myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 - Sleep(50); - myHelpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); - myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); - } - } - } - } - - - - UINT8 ff = myHelpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //DaytonaUSA - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - if (FFBMode == 0) - { - if ((ff > 0x09)& (ff < 0x18)) - { - //Spring - double percentForce = (ff - 15) / 8.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x1F)& (ff < 0x28)) - { - //Clutch - double percentForce = (ff - 31) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0x2F)& (ff < 0x3D)) - { - //Centering - double percentForce = (ff - 47) / 13.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x3F)& (ff < 0x48)) - { - //Uncentering - double percentForce = (ff - 63) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - else if ((ff > 0x4F)& (ff < 0x58)) - { - //Roll Left - double percentForce = (ff - 79) / 8.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff > 0x5F)& (ff < 0x68)) - { - //Roll Right - double percentForce = (ff - 95) / 8.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff > 0x09)& (ff < 0x18)) - { - //Spring - double percentForce = (ff - 15) / 8.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x1F)& (ff < 0x28)) - { - //Clutch - double percentForce = (ff - 31) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0x2F)& (ff < 0x3D)) - { - //Centering - double percentForce = (ff - 47) / 13.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x3F)& (ff < 0x48)) - { - //Uncentering - double percentForce = (ff - 63) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - else if ((ff > 0x4F)& (ff < 0x58)) - { - //Roll Left - double percentForce = (ff - 79) / 8.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff > 0x5F)& (ff < 0x68)) - { - //Roll Right - double percentForce = (ff - 95) / 8.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - else if (hWnd3 > NULL) + + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //DaytonaUSA + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) { +<<<<<<< HEAD UINT8 ff = myHelpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Indy500 std::string ffs = std::to_string(ff); myHelpers->log((char*)ffs.c_str()); @@ -843,10 +739,21 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) @@ -1040,18 +947,45 @@ static int RunningThread(void* ptr) myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } @@ -1073,10 +1007,27 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) @@ -1270,18 +1221,45 @@ static int RunningThread(void* ptr) myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } @@ -1310,10 +1288,34 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd3 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Indy500 + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x3D)) @@ -3333,100 +3335,49 @@ static int RunningThread(void* ptr) myHelpers->log((char*)ffs.c_str()); myHelpers->log("got value: "); if (FFBMode == 0) - { - if ((ff > 0x09)& (ff < 0x18)) - { - //Spring - double percentForce = (ff - 15) / 8.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x1F)& (ff < 0x28)) - { - //Clutch - double percentForce = (ff - 31) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0x2F)& (ff < 0x3D)) - { - //Centering - double percentForce = (ff - 47) / 13.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x3F)& (ff < 0x48)) - { - //Uncentering - double percentForce = (ff - 63) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - else if ((ff > 0x4F)& (ff < 0x58)) - { - //Roll Left - double percentForce = (ff - 79) / 8.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff > 0x5F)& (ff < 0x68)) - { - //Roll Right - double percentForce = (ff - 95) / 8.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } +======= + triggers->Friction(percentForce); } - else + else if ((ff > 0x2F) & (ff < 0x38)) { - if ((ff > 0x09)& (ff < 0x18)) - { - //Spring - double percentForce = (ff - 15) / 8.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x1F)& (ff < 0x28)) - { - //Clutch - double percentForce = (ff - 31) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0x2F)& (ff < 0x3D)) - { - //Centering - double percentForce = (ff - 47) / 13.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x3F)& (ff < 0x48)) - { - //Uncentering - double percentForce = (ff - 63) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - else if ((ff > 0x4F)& (ff < 0x58)) - { - //Roll Left - double percentForce = (ff - 79) / 8.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff > 0x5F)& (ff < 0x68)) - { - //Roll Right - double percentForce = (ff - 95) / 8.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } } +<<<<<<< HEAD } else if (hWnd11 > NULL) { @@ -4035,25 +3986,72 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -4061,46 +4059,3837 @@ static int RunningThread(void* ptr) else { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd4 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Sega Touring Car Championship + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) { //Spring - double percentForce = (ff - 15) / 8.0; + double percentForce = (ff - 10) / 14.0; double percentLength = 100; - myTriggers->Spring(percentForce); + triggers->Spring(percentForce); } - else if ((ff > 0x1F)& (ff < 0x28)) + else if ((ff > 0x1F) & (ff < 0x28)) { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; - myTriggers->Friction(percentForce); + triggers->Friction(percentForce); } - else if ((ff > 0x2F)& (ff < 0x3D)) + else if ((ff > 0x2F) & (ff < 0x38)) { //Centering - double percentForce = (ff - 47) / 13.0; + double percentForce = (ff - 47) / 8.0; double percentLength = 100; - myTriggers->Spring(percentForce); + triggers->Spring(percentForce); } - else if ((ff > 0x3F)& (ff < 0x48)) + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); + triggers->Sine(70, 80, percentForce); } - else if ((ff > 0x4F)& (ff < 0x58)) + else if ((ff > 0x4F) & (ff < 0x58)) { //Roll Left double percentForce = (ff - 79) / 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, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } - else if ((ff > 0x5F)& (ff < 0x68)) + else if ((ff > 0x5F) & (ff < 0x68)) { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd5 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //OverRev + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd6 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Super GT 24h + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd7 > NULL) + { + + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA '93 Edition + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd8 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA (Saturn Ads) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd9 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA Special Edition + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd10 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA Turbo + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd11 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA Turbo (Rev A) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd12 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); + } + + if (DaytonaAIMultiplayerHack == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); + + + if (gamestate == 0x1A) + { + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); + } + + if (trackselect == 0x01) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); + } + + if (linksize == 0x02) + { + if (linkID == 0x02) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x03) + { + if (linkID == 0x03) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + } + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA: GTX 2004 + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Spring(percentForce); + } + else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Friction(percentForce); + } + else if ((ff > 0x2F)& (ff < 0x3D)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Spring(percentForce); + } + else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } @@ -4113,10 +7902,72 @@ static int RunningThread(void* ptr) INT_PTR Rambase = myHelpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); INT_PTR Rambase1 = myHelpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); myHelpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd13 > NULL) + { + if (DaytonaForcePanoramicAttract == 1) + { + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1070, 0x00, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if (DaytonaAIMultiplayerHack == 1) { +<<<<<<< HEAD INT_PTR Rambase = myHelpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); INT_PTR Rambase1 = myHelpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); UINT8 gamestate = myHelpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); @@ -4134,20 +7985,51 @@ static int RunningThread(void* ptr) UINT8 nop1 = myHelpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); UINT8 nop2 = myHelpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); UINT8 nop3 = myHelpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); +======= + INT_PTR Rambase = helpers->ReadIntPtr(0x1AA888, /* isRelativeOffset*/ true); + INT_PTR Rambase1 = helpers->ReadIntPtr(Rambase + 0x100, /* isRelativeOffset */ false); + UINT8 gamestate = helpers->ReadByte(Rambase1 + 0x10A4, /* isRelativeOffset*/ false); + UINT8 track = helpers->ReadByte(Rambase1 + 0x1460, /* isRelativeOffset*/ false); + UINT8 trackselect = helpers->ReadByte(Rambase1 + 0x1468, /* isRelativeOffset*/ false); + UINT8 countdown = helpers->ReadByte(Rambase1 + 0x1850, /* isRelativeOffset*/ false); + UINT8 linksize = helpers->ReadByte(Rambase1 + 0x40001, /* isRelativeOffset*/ false); + UINT8 linkID = helpers->ReadByte(Rambase1 + 0x40002, /* isRelativeOffset*/ false); + INT_PTR gamestatetimer = helpers->ReadIntPtr(Rambase1 + 0x10A8, /* isRelativeOffset*/ false); + UINT8 camhack = helpers->ReadByte(Rambase1 + 0x14A4, /* isRelativeOffset*/ false); + UINT8 carsinfront = helpers->ReadByte(Rambase1 + 0x51EC, /* isRelativeOffset*/ false); + UINT8 mpposition = helpers->ReadByte(Rambase1 + 0x51ED, /* isRelativeOffset*/ false); + float cary = helpers->ReadFloat32(Rambase1 + 0x519C, /* isRelativeOffset */ false); + float carx = helpers->ReadFloat32(Rambase1 + 0x51A4, /* isRelativeOffset */ false); + UINT8 nop1 = helpers->ReadByte(0xC2130, /* isRelativeOffset*/ true); + UINT8 nop2 = helpers->ReadByte(0xC2131, /* isRelativeOffset*/ true); + UINT8 nop3 = helpers->ReadByte(0xC2132, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc if (gamestate == 0x1A) { +<<<<<<< HEAD myHelpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); +======= + helpers->WriteByte(Rambase1 + 0x51ED, carsinfront, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if (trackselect == 0x01) { +<<<<<<< HEAD myHelpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); } else if (trackselect == 0x02) { myHelpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); +======= + helpers->WriteByte(Rambase1 + 0x1460, 0x02, /* isRelativeOffset*/ false); + } + else if (trackselect == 0x02) + { + helpers->WriteByte(Rambase1 + 0x1460, 0x01, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if (linksize == 0x02) @@ -4156,6 +8038,7 @@ static int RunningThread(void* ptr) { if (gamestate > 0x07) { +<<<<<<< HEAD myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); @@ -4166,10 +8049,23 @@ static int RunningThread(void* ptr) myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +======= + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) { Sleep(150); +<<<<<<< HEAD myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 Sleep(50); myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race @@ -4185,19 +8081,43 @@ static int RunningThread(void* ptr) Sleep(50); myHelpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); +======= + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } } else if (linkID == 0x01) { if ((gamestate == 0x1A) & (gamestatetimer < 100)) { +<<<<<<< HEAD myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +======= + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } else if ((gamestate == 0x1A) & (gamestatetimer > 100)) { Sleep(100); +<<<<<<< HEAD myHelpers->WriteNop(0xC2130, true); myHelpers->WriteNop(0xC2131, true); myHelpers->WriteNop(0xC2132, true); @@ -4208,10 +8128,23 @@ static int RunningThread(void* ptr) myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +======= + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if (gamestate > 0x07) { +<<<<<<< HEAD myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); @@ -4246,6 +8179,42 @@ static int RunningThread(void* ptr) Sleep(50); myHelpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); myHelpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); +======= + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 0.0, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } } } @@ -4255,6 +8224,7 @@ static int RunningThread(void* ptr) { if (gamestate > 0x07) { +<<<<<<< HEAD myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); @@ -4265,10 +8235,23 @@ static int RunningThread(void* ptr) myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +======= + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) { Sleep(250); +<<<<<<< HEAD myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 Sleep(50); myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race @@ -4289,19 +8272,308 @@ static int RunningThread(void* ptr) if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) { myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); +======= + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); } } else if (linkID == 0x02) { if ((gamestate == 0x1A) & (gamestatetimer < 100)) { - myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); - myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); } else if ((gamestate == 0x1A) & (gamestatetimer > 100)) { Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(150); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + else if (linkID == 0x01) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } + } + else if (linksize == 0x04) + { + if (linkID == 0x04) + { + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(250); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC302CAF4, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37C0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + } + if (linkID == 0x03) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C40, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + Sleep(350); + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37CF3D0, /* isRelativeOffset */ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + helpers->WriteFloat32(Rambase1 + 0x519C, 450.0, /* isRelativeOffset */ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + } + } + else if (linkID == 0x02) + { + if ((gamestate == 0x1A) & (gamestatetimer < 100)) + { +<<<<<<< HEAD + myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +======= + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + } + else if ((gamestate == 0x1A) & (gamestatetimer > 100)) + { + Sleep(100); +<<<<<<< HEAD myHelpers->WriteNop(0xC2130, true); myHelpers->WriteNop(0xC2131, true); myHelpers->WriteNop(0xC2132, true); @@ -4325,10 +8597,36 @@ static int RunningThread(void* ptr) myHelpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); myHelpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +======= + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); + } + if (gamestate > 0x07) + { + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x01, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) { Sleep(150); +<<<<<<< HEAD myHelpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 Sleep(50); myHelpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race @@ -4348,19 +8646,47 @@ static int RunningThread(void* ptr) if ((gamestatetimer > 4294964133)& (gamestate == 0x12)) { myHelpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); +======= + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02 || track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } } else if (linkID == 0x01) { if ((gamestate == 0x1A) & (gamestatetimer < 100)) { +<<<<<<< HEAD myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +======= + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } else if ((gamestate == 0x1A) & (gamestatetimer > 100)) { Sleep(100); +<<<<<<< HEAD myHelpers->WriteNop(0xC2130, true); myHelpers->WriteNop(0xC2131, true); myHelpers->WriteNop(0xC2132, true); @@ -4371,10 +8697,23 @@ static int RunningThread(void* ptr) myHelpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); myHelpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +======= + helpers->WriteNop(0xC2130, true); + helpers->WriteNop(0xC2131, true); + helpers->WriteNop(0xC2132, true); + } + + if ((gamestate > 0x1A) & (gamestate < 0x1A)) + { + helpers->WriteByte(0xC2130, 0x88, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2131, 0x14, /* isRelativeOffset*/ true); + helpers->WriteByte(0xC2132, 0x01, /* isRelativeOffset*/ true); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc } if (gamestate > 0x07) { +<<<<<<< HEAD myHelpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540CC0, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540C80, /* isRelativeOffset*/ false); myHelpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540C80, /* isRelativeOffset*/ false); @@ -4699,86 +9038,218 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) - { - //Clutch - double percentForce = (ff - 31) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0x2F)& (ff < 0x3D)) - { - //Centering - double percentForce = (ff - 47) / 13.0; - double percentLength = 100; - myTriggers->Spring(percentForce); - } - else if ((ff > 0x3F)& (ff < 0x48)) - { - //Uncentering - double percentForce = (ff - 63) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - else if ((ff > 0x4F)& (ff < 0x58)) - { - //Roll Left - double percentForce = (ff - 79) / 8.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff > 0x5F)& (ff < 0x68)) - { - //Roll Right - double percentForce = (ff - 95) / 8.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); +======= + helpers->WriteIntPtr(Rambase1 + 0x40004, 0x00540D00, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x40008, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteIntPtr(Rambase1 + 0x4000C, 0x00540CC0, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5484, 0x00, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5784, 0x02, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5A84, 0x03, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x5D84, 0x04, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6084, 0x05, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6384, 0x06, /* isRelativeOffset*/ false); + helpers->WriteByte(Rambase1 + 0x6684, 0x07, /* isRelativeOffset*/ false); + } + if ((gamestatetimer > 4294964133) & (gamestate == 0x12)) + { + helpers->WriteIntPtr(Rambase1 + 0x10A8, 0x3B6, /* isRelativeOffset*/ false); + } + if ((gamestate == 0x16) & (countdown == 0x00) & (track == 0x00)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + helpers->WriteByte(Rambase1 + 0x1850, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x01)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC2F195E8, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + else if ((gamestate == 0x14) & (trackselect == 0x00) & (track == 0x02)) + { + helpers->WriteByte(Rambase1 + 0x40000, 0x99, /* isRelativeOffset*/ false); // change to 99 + Sleep(50); + helpers->WriteByte(Rambase1 + 0x10A4, 0x13, /* isRelativeOffset*/ false); // restart race + Sleep(50); + helpers->WriteByte(Rambase1 + 0x40000, 0x01, /* isRelativeOffset*/ false); // change back to 1 + Sleep(50); + helpers->WriteIntPtr(Rambase1 + 0x51A4, 0xC37E0001, /* isRelativeOffset */ false); + helpers->WriteByte(Rambase1 + 0x1468, 0x01, /* isRelativeOffset*/ false); + } + } } } - else + + UINT8 ff = helpers->ReadByte(0x0057285B, /* isRelativeOffset*/ false); //Daytona USA: To The Maxx + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) { - if ((ff > 0x09)& (ff < 0x18)) + if ((ff > 0x09) & (ff < 0x18)) { //Spring double percentForce = (ff - 15) / 8.0; double percentLength = 100; - myTriggers->Spring(percentForce); + triggers->Spring(percentForce); } - else if ((ff > 0x1F)& (ff < 0x28)) + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x3D)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 13.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); +<<<<<<< HEAD + myTriggers->Rumble(0, percentForce, percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD + myTriggers->Rumble(percentForce, 0, percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + } + } + else + { +<<<<<<< HEAD + if ((ff > 0x09)& (ff < 0x18)) +======= + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Spring + double percentForce = (ff - 15) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Spring(percentForce); + } + else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Friction(percentForce); + } + else if ((ff > 0x2F)& (ff < 0x3D)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x3D)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Centering + double percentForce = (ff - 47) / 13.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Spring(percentForce); + } + else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; +<<<<<<< HEAD + myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } @@ -5377,10 +9848,293 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd14 > NULL) + { + UINT8 ff = helpers->ReadByte(0x174CF4, /* isRelativeOffset*/ true); //Sega Rally Championship (Rev B) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd15 > NULL) + { + UINT8 ff = helpers->ReadByte(0x174CF4, /* isRelativeOffset*/ true); //Sega Rally Pro Drivin' + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0xBF) & (ff < 0xDF)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 191) / 31.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x7F) & (ff < 0x9F)) + { + helpers->log("moving wheel right"); + double percentForce = (ff - 127) / 31.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd16 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Indianapolis 500 (Rev A, Twin, Newer rev) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd17 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Indianapolis 500 (Rev A, Twin, Older rev) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) + { + //Uncentering + double percentForce = (ff - 63) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) + { + //Roll Left + double percentForce = (ff - 79) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) + { + //Roll Right + double percentForce = (ff - 95) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc + { + //Clutch + double percentForce = (ff - 31) / 8.0; + double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x3D)) @@ -5391,25 +10145,58 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -5424,10 +10211,34 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd18 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Sega Touring Car Championship + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) + { + //Spring + double percentForce = (ff - 10) / 14.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x3D)) @@ -5438,25 +10249,58 @@ static int RunningThread(void* ptr) myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) + { + //Centering + double percentForce = (ff - 47) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) + { + //Centeringtestmenu + double percentForce = (ff - 55) / 8.0; + double percentLength = 100; + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } @@ -5561,53 +10405,100 @@ static int RunningThread(void* ptr) if (FFBMode == 0) { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Spring double percentForce = (ff - 10) / 14.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x37)& (ff < 0x40)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centeringtestmenu double percentForce = (ff - 55) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -5676,53 +10567,107 @@ static int RunningThread(void* ptr) if (FFBMode == 0) { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd19 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Sega Touring Car Championship (Rev B) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Spring double percentForce = (ff - 10) / 14.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x37)& (ff < 0x40)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centeringtestmenu double percentForce = (ff - 55) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -5791,53 +10736,100 @@ static int RunningThread(void* ptr) if (FFBMode == 0) { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Spring double percentForce = (ff - 10) / 14.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x37)& (ff < 0x40)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centeringtestmenu double percentForce = (ff - 55) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -5906,53 +10898,107 @@ static int RunningThread(void* ptr) if (FFBMode == 0) { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd20 > NULL) + { + UINT8 ff = helpers->ReadByte(0x17285B, /* isRelativeOffset*/ true); //Over Rev (Model 2B) + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + if (FFBMode == 0) + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Spring double percentForce = (ff - 10) / 14.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x37)& (ff < 0x40)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centeringtestmenu double percentForce = (ff - 55) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -6021,53 +11067,100 @@ static int RunningThread(void* ptr) if (FFBMode == 0) { if ((ff > 0x09)& (ff < 0x18)) +======= + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0x09) & (ff < 0x18)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Spring double percentForce = (ff - 10) / 14.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x1F)& (ff < 0x28)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x1F) & (ff < 0x28)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Clutch double percentForce = (ff - 31) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Friction(percentForce); } else if ((ff > 0x2F)& (ff < 0x38)) +======= + triggers->Friction(percentForce); + } + else if ((ff > 0x2F) & (ff < 0x38)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centering double percentForce = (ff - 47) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x37)& (ff < 0x40)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x37) & (ff < 0x40)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Centeringtestmenu double percentForce = (ff - 55) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Spring(percentForce); } else if ((ff > 0x3F)& (ff < 0x48)) +======= + triggers->Spring(percentForce); + } + else if ((ff > 0x3F) & (ff < 0x48)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Uncentering double percentForce = (ff - 63) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Sine(70, 80, percentForce); } else if ((ff > 0x4F)& (ff < 0x58)) +======= + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0x4F) & (ff < 0x58)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Left double percentForce = (ff - 79) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(0, percentForce, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); } else if ((ff > 0x5F)& (ff < 0x68)) +======= + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x5F) & (ff < 0x68)) +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc { //Roll Right double percentForce = (ff - 95) / 8.0; double percentLength = 100; +<<<<<<< HEAD myTriggers->Rumble(percentForce, 0, percentLength); myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); } @@ -6146,4 +11239,12 @@ void M2Emulator::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTri myConstants = constants; myHelpers = helpers; } -} \ No newline at end of file +} +======= + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} +>>>>>>> parent of ea7f309... Make every game plugin have Running Thread etc diff --git a/Game Files/Machstorm.cpp b/Game Files/Machstorm.cpp index a707b00..ab0da56 100644 --- a/Game Files/Machstorm.cpp +++ b/Game Files/Machstorm.cpp @@ -13,183 +13,160 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "Machstorm.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) - { - static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - 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); - int Power4RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power4RumbleStrength"), 0, settingsFilename); - int Power5RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power5RumbleStrength"), 0, settingsFilename); - int Power6RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power6RumbleStrength"), 0, settingsFilename); - int Power7RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power7RumbleStrength"), 0, settingsFilename); - int Power8RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power8RumbleStrength"), 0, settingsFilename); - int Power9RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power9RumbleStrength"), 0, settingsFilename); - int Power10RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power10RumbleStrength"), 0, settingsFilename); - int Power1RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power1RumbleLength"), 0, settingsFilename); - int Power2RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power2RumbleLength"), 0, settingsFilename); - int Power3RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power3RumbleLength"), 0, settingsFilename); - int Power4RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power4RumbleLength"), 0, settingsFilename); - int Power5RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power5RumbleLength"), 0, settingsFilename); - int Power6RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power6RumbleLength"), 0, settingsFilename); - int Power7RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power7RumbleLength"), 0, settingsFilename); - 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); - - if (vibration == 16842753) - { - if (power == 61542) - { - double percentLength = (Power1RumbleLength); - double percentForce = ((Power1RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61543) - { - double percentLength = (Power2RumbleLength); - double percentForce = ((Power2RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61544) - { - double percentLength = (Power3RumbleLength); - double percentForce = ((Power3RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61545) - { - double percentLength = (Power4RumbleLength); - double percentForce = ((Power4RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61546) - { - double percentLength = (Power5RumbleLength); - double percentForce = ((Power5RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61547) - { - double percentLength = (Power6RumbleLength); - double percentForce = ((Power6RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61548) - { - double percentLength = (Power7RumbleLength); - double percentForce = ((Power7RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61549) - { - double percentLength = (Power8RumbleLength); - double percentForce = ((Power8RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61550) - { - double percentLength = (Power9RumbleLength); - double percentForce = ((Power9RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 61551) - { - double percentLength = (Power10RumbleLength); - double percentForce = ((Power10RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - } - if (vibration == 1) - { - if (power == 16773366) - { - double percentLength = (Power1RumbleLength); - double percentForce = ((Power1RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773367) - { - double percentLength = (Power2RumbleLength); - double percentForce = ((Power2RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773368) - { - double percentLength = (Power3RumbleLength); - double percentForce = ((Power3RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773369) - { - double percentLength = (Power4RumbleLength); - double percentForce = ((Power4RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773370) - { - double percentLength = (Power5RumbleLength); - double percentForce = ((Power5RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773371) - { - double percentLength = (Power6RumbleLength); - double percentForce = ((Power6RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773372) - { - double percentLength = (Power7RumbleLength); - double percentForce = ((Power7RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773373) - { - double percentLength = (Power8RumbleLength); - double percentForce = ((Power8RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773374) - { - double percentLength = (Power9RumbleLength); - double percentForce = ((Power9RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (power == 16773375) - { - double percentLength = (Power10RumbleLength); - double percentForce = ((Power10RumbleStrength) / 100.0); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - } - } - return 0; -} +typedef unsigned char U8; +typedef unsigned int U32; +typedef uint16_t U16; void Machstorm::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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); + int Power4RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power4RumbleStrength"), 0, settingsFilename); + int Power5RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power5RumbleStrength"), 0, settingsFilename); + int Power6RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power6RumbleStrength"), 0, settingsFilename); + int Power7RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power7RumbleStrength"), 0, settingsFilename); + int Power8RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power8RumbleStrength"), 0, settingsFilename); + int Power9RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power9RumbleStrength"), 0, settingsFilename); + int Power10RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power10RumbleStrength"), 0, settingsFilename); + int Power1RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power1RumbleLength"), 0, settingsFilename); + int Power2RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power2RumbleLength"), 0, settingsFilename); + int Power3RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power3RumbleLength"), 0, settingsFilename); + int Power4RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power4RumbleLength"), 0, settingsFilename); + int Power5RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power5RumbleLength"), 0, settingsFilename); + int Power6RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power6RumbleLength"), 0, settingsFilename); + int Power7RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Power7RumbleLength"), 0, settingsFilename); + 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 = helpers->ReadInt32(0x6390E9, /* relative */ true); + int power = helpers->ReadInt32(0x639109, /* relative */ true); - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (vibration == 16842753) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + if (power == 61542) + { + double percentLength = (Power1RumbleLength); + double percentForce = ((Power1RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61543) + { + double percentLength = (Power2RumbleLength); + double percentForce = ((Power2RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61544) + { + double percentLength = (Power3RumbleLength); + double percentForce = ((Power3RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61545) + { + double percentLength = (Power4RumbleLength); + double percentForce = ((Power4RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61546) + { + double percentLength = (Power5RumbleLength); + double percentForce = ((Power5RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61547) + { + double percentLength = (Power6RumbleLength); + double percentForce = ((Power6RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61548) + { + double percentLength = (Power7RumbleLength); + double percentForce = ((Power7RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61549) + { + double percentLength = (Power8RumbleLength); + double percentForce = ((Power8RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61550) + { + double percentLength = (Power9RumbleLength); + double percentForce = ((Power9RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 61551) + { + double percentLength = (Power10RumbleLength); + double percentForce = ((Power10RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + } + if (vibration == 1) + { + if (power == 16773366) + { + double percentLength = (Power1RumbleLength); + double percentForce = ((Power1RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773367) + { + double percentLength = (Power2RumbleLength); + double percentForce = ((Power2RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773368) + { + double percentLength = (Power3RumbleLength); + double percentForce = ((Power3RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773369) + { + double percentLength = (Power4RumbleLength); + double percentForce = ((Power4RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773370) + { + double percentLength = (Power5RumbleLength); + double percentForce = ((Power5RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773371) + { + double percentLength = (Power6RumbleLength); + double percentForce = ((Power6RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773372) + { + double percentLength = (Power7RumbleLength); + double percentForce = ((Power7RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773373) + { + double percentLength = (Power8RumbleLength); + double percentForce = ((Power8RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773374) + { + double percentLength = (Power9RumbleLength); + double percentForce = ((Power9RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (power == 16773375) + { + double percentLength = (Power10RumbleLength); + double percentForce = ((Power10RumbleStrength) / 100.0); + triggers->Rumble(percentForce, percentForce, percentLength); + } } } \ No newline at end of file diff --git a/Game Files/Machstorm.h b/Game Files/Machstorm.h index b3e236f..1971afe 100644 --- a/Game Files/Machstorm.h +++ b/Game Files/Machstorm.h @@ -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); diff --git a/Game Files/Mame0199.cpp b/Game Files/Mame0199.cpp index ba1a1d0..106fd91 100644 --- a/Game Files/Mame0199.cpp +++ b/Game Files/Mame0199.cpp @@ -15,11 +15,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "Mame0199.h" #include "math.h" -#include "SDL.h" -static EffectTriggers* myTriggers; -static EffectConstants* myConstants; -static Helpers* myHelpers; -static SDL_Event e; static int sanfran(int ffsan) { switch (ffsan) { @@ -1654,1551 +1649,1528 @@ static int raveracer(int ffRaw) { } } -static int RunningThread(void* ptr) -{ - int cnt; - for (cnt = 0; cnt >= 0; ++cnt) +void Mame0199::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) { + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + HWND hWnds = FindWindow(NULL, _T("MAME: San Francisco Rush 2049 [sf2049]")); + HWND hWnd = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (boot rom L 1.0, GUTS Oct 6 1997 / MAIN Oct 16 1997) [sfrushrk]")); + HWND hWnd1 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.0) [sfrush]")); + HWND hWnd2 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (Wavenet, boot rom L 1.38, GUTS Aug 6 1997 / MAIN Aug 5 1997) [sfrushrkwo]")); + HWND hWnd3 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Special Edition [sf2049se]")); + HWND hWnd4 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV2, World) [raveracw]")); + HWND hWnd5 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1 Ver.B, Japan) [raveracj]")); + HWND hWnd6 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1, Japan) [raveracja]")); + HWND hWnd7 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.06A) [sfrusha]")); + HWND hWnd8 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Tournament Edition [sf2049te]")); + HWND hWnd9 = FindWindowA(0, ("MAME: California Speed (Version 2.1a Apr 17 1998, GUTS 1.25 Apr 17 1998 / MAIN Apr 17 1998) [calspeed]")); + HWND hWnd10 = FindWindowA(0, ("MAME: California Speed (Version 1.0r8 Mar 10 1998, GUTS Mar 10 1998 / MAIN Mar 10 1998) [calspeeda]")); + HWND hWnd11 = FindWindowA(0, ("MAME: California Speed (Version 1.0r7a Mar 4 1998, GUTS Mar 3 1998 / MAIN Jan 19 1998) [calspeedb]")); + HWND hWnd12 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.5) [crusnwld]")); + HWND hWnd13 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.4) [crusnwld24]")); + HWND hWnd14 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.3) [crusnwld23]")); + HWND hWnd15 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.0) [crusnwld20]")); + HWND hWnd16 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.9) [crusnwld19]")); + HWND hWnd17 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.7) [crusnwld17]")); + HWND hWnd18 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.3) [crusnwld13]")); + HWND hWnd19 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.1) [crusnusa]")); + HWND hWnd20 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.0) [crusnusa40]")); + HWND hWnd21 = FindWindowA(0, ("MAME: Cruis'n USA (rev L2.1) [crusnusa21]")); + HWND hWnd22 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); + HWND hWnd23 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); + HWND hWnd24 = FindWindowA(0, ("MAME: Off Road Challenge (v1.40) [offroadc4]")); + HWND hWnd25 = FindWindowA(0, ("MAME: Off Road Challenge (v1.30) [offroadc3]")); + HWND hWnd26 = FindWindowA(0, ("MAME: Off Road Challenge (v1.10) [offroadc1]")); + + if (hWnds > NULL) { - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - HWND hWnds = FindWindow(NULL, _T("MAME: San Francisco Rush 2049 [sf2049]")); - HWND hWnd = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (boot rom L 1.0, GUTS Oct 6 1997 / MAIN Oct 16 1997) [sfrushrk]")); - HWND hWnd1 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.0) [sfrush]")); - HWND hWnd2 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (Wavenet, boot rom L 1.38, GUTS Aug 6 1997 / MAIN Aug 5 1997) [sfrushrkwo]")); - HWND hWnd3 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Special Edition [sf2049se]")); - HWND hWnd4 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV2, World) [raveracw]")); - HWND hWnd5 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1 Ver.B, Japan) [raveracj]")); - HWND hWnd6 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1, Japan) [raveracja]")); - HWND hWnd7 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.06A) [sfrusha]")); - HWND hWnd8 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Tournament Edition [sf2049te]")); - HWND hWnd9 = FindWindowA(0, ("MAME: California Speed (Version 2.1a Apr 17 1998, GUTS 1.25 Apr 17 1998 / MAIN Apr 17 1998) [calspeed]")); - HWND hWnd10 = FindWindowA(0, ("MAME: California Speed (Version 1.0r8 Mar 10 1998, GUTS Mar 10 1998 / MAIN Mar 10 1998) [calspeeda]")); - HWND hWnd11 = FindWindowA(0, ("MAME: California Speed (Version 1.0r7a Mar 4 1998, GUTS Mar 3 1998 / MAIN Jan 19 1998) [calspeedb]")); - HWND hWnd12 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.5) [crusnwld]")); - HWND hWnd13 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.4) [crusnwld24]")); - HWND hWnd14 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.3) [crusnwld23]")); - HWND hWnd15 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.0) [crusnwld20]")); - HWND hWnd16 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.9) [crusnwld19]")); - HWND hWnd17 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.7) [crusnwld17]")); - HWND hWnd18 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.3) [crusnwld13]")); - HWND hWnd19 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.1) [crusnusa]")); - HWND hWnd20 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.0) [crusnusa40]")); - HWND hWnd21 = FindWindowA(0, ("MAME: Cruis'n USA (rev L2.1) [crusnusa21]")); - HWND hWnd22 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); - HWND hWnd23 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); - HWND hWnd24 = FindWindowA(0, ("MAME: Off Road Challenge (v1.40) [offroadc4]")); - HWND hWnd25 = FindWindowA(0, ("MAME: Off Road Challenge (v1.30) [offroadc3]")); - HWND hWnd26 = FindWindowA(0, ("MAME: Off Road Challenge (v1.10) [offroadc1]")); + INT_PTR ff2049 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff20493 = helpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff20494 = helpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); - if (hWnds > NULL) + if (FFBMode == 0) { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff20493 = myHelpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff20494 = myHelpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) + if ((ff20495 > 0x80) & (ff20495 < 0x100)) { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); } - else + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); } } - else if (hWnd > NULL) + else { - int ffsanfranrush = 0; + if ((ff20495 > 0x80) & (ff20495 < 0x100)) { - INT_PTR ff = myHelpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff4 = myHelpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); } - } - else if (hWnd1 > NULL) - { - int ffsanfranrush = 0; + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) { - INT_PTR ff = myHelpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff4 = myHelpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - else if (hWnd2 > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff4 = myHelpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd3 > NULL) - { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff20493 = myHelpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff20494 = myHelpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - else if (hWnd7 > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff4 = myHelpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd4 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ffrave4 = myHelpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - - if (hWnd5 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ffrave4 = myHelpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit - - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd6 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ffrave4 = myHelpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit - - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd8 > NULL) - { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); - INT_PTR ff20493 = myHelpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); - INT_PTR ff20494 = myHelpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd9 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); - INT_PTR ffcal4 = myHelpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffcal5 = myHelpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd10 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); - INT_PTR ffcal4 = myHelpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffcal5 = myHelpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd11 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); - INT_PTR ffcal4 = myHelpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffcal5 = myHelpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd12 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd13 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd14 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd15 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd16 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd17 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd18 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd19 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd20 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd21 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); - INT_PTR ffcru4 = myHelpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); - INT_PTR ffcru5 = myHelpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd22 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffoff4 = myHelpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); - INT_PTR ffoff5 = myHelpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd23 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffoff4 = myHelpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); - INT_PTR ffoff5 = myHelpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd24 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffoff4 = myHelpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); - INT_PTR ffoff5 = myHelpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd25 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffoff4 = myHelpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); - INT_PTR ffoff5 = myHelpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd26 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffoff4 = myHelpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); - INT_PTR ffoff5 = myHelpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff4 = helpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); } } } - return 0; } - -void Mame0199::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 if (hWnd1 > NULL) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff4 = helpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } } -} \ No newline at end of file +} + else if (hWnd2 > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff4 = helpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd3 > NULL) + { + INT_PTR ff2049 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff20493 = helpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff20494 = helpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd7 > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0096D760, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x34C, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff4 = helpers->ReadIntPtr(ff3 + 0x1C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff4 + 0x70C, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + if (hWnd4 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ffrave4 = helpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + + if (hWnd5 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ffrave4 = helpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit + + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd6 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ffrave4 = helpers->ReadIntPtr(ffrave3 + 0x3D8, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave4 + 0x42, /* isRelativeOffset */ false); //Rave Racer 32bit + + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd8 > NULL) + { + INT_PTR ff2049 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x34, /* isRelativeOffset*/ false); + INT_PTR ff20493 = helpers->ReadIntPtr(ff20492 + 0x18, /* isRelativeOffset*/ false); + INT_PTR ff20494 = helpers->ReadIntPtr(ff20493 + 0x54, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20494 + 0x4E8, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd9 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); + INT_PTR ffcal4 = helpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffcal5 = helpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd10 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); + INT_PTR ffcal4 = helpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffcal5 = helpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd11 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); + INT_PTR ffcal4 = helpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffcal5 = helpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd12 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd13 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd14 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd15 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd16 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd17 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd18 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd19 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd20 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd21 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x134, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffcru4 = helpers->ReadIntPtr(ffcru3 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru5 = helpers->ReadIntPtr(ffcru4 + 0x20, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru5 + 0x5A0, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd22 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffoff4 = helpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff5 = helpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd23 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffoff4 = helpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff5 = helpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd24 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffoff4 = helpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff5 = helpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd25 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffoff4 = helpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff5 = helpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd26 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x0C61E0A4, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x60, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffoff4 = helpers->ReadIntPtr(ffoff3 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff5 = helpers->ReadIntPtr(ffoff4 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff5 + 0x3C, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } \ No newline at end of file diff --git a/Game Files/Mame0206.cpp b/Game Files/Mame0206.cpp index b02e3d1..2d48727 100644 --- a/Game Files/Mame0206.cpp +++ b/Game Files/Mame0206.cpp @@ -15,11 +15,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "Mame0206.h" #include "math.h" -#include "SDL.h" -static EffectTriggers* myTriggers; -static EffectConstants* myConstants; -static Helpers* myHelpers; -static SDL_Event e; static int sanfran(int ffsan) { switch (ffsan) { @@ -1654,1504 +1649,1481 @@ static int raveracer(int ffRaw) { } } -static int RunningThread(void* ptr) -{ - int cnt; - for (cnt = 0; cnt >= 0; ++cnt) +void Mame0206::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) { + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + HWND hWnds = FindWindow(NULL, _T("MAME: San Francisco Rush 2049 [sf2049]")); + HWND hWnd = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (boot rom L 1.0, GUTS Oct 6 1997 / MAIN Oct 16 1997) [sfrushrk]")); + HWND hWnd1 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.0) [sfrush]")); + HWND hWnd2 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (Wavenet, boot rom L 1.38, GUTS Aug 6 1997 / MAIN Aug 5 1997) [sfrushrkwo]")); + HWND hWnd3 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Special Edition [sf2049se]")); + HWND hWnd4 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV2, World) [raveracw]")); + HWND hWnd5 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1 Ver.B, Japan) [raveracj]")); + HWND hWnd6 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1, Japan) [raveracja]")); + HWND hWnd7 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.06A) [sfrusha]")); + HWND hWnd8 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Tournament Edition [sf2049te]")); + HWND hWnd9 = FindWindowA(0, ("MAME: California Speed (Version 2.1a Apr 17 1998, GUTS 1.25 Apr 17 1998 / MAIN Apr 17 1998) [calspeed]")); + HWND hWnd10 = FindWindowA(0, ("MAME: California Speed (Version 1.0r8 Mar 10 1998, GUTS Mar 10 1998 / MAIN Mar 10 1998) [calspeeda]")); + HWND hWnd11 = FindWindowA(0, ("MAME: California Speed (Version 1.0r7a Mar 4 1998, GUTS Mar 3 1998 / MAIN Jan 19 1998) [calspeedb]")); + HWND hWnd12 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.5) [crusnwld]")); + HWND hWnd13 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.4) [crusnwld24]")); + HWND hWnd14 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.3) [crusnwld23]")); + HWND hWnd15 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.0) [crusnwld20]")); + HWND hWnd16 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.9) [crusnwld19]")); + HWND hWnd17 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.7) [crusnwld17]")); + HWND hWnd18 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.3) [crusnwld13]")); + HWND hWnd19 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.1) [crusnusa]")); + HWND hWnd20 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.0) [crusnusa40]")); + HWND hWnd21 = FindWindowA(0, ("MAME: Cruis'n USA (rev L2.1) [crusnusa21]")); + HWND hWnd22 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); + HWND hWnd23 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); + HWND hWnd24 = FindWindowA(0, ("MAME: Off Road Challenge (v1.40) [offroadc4]")); + HWND hWnd25 = FindWindowA(0, ("MAME: Off Road Challenge (v1.30) [offroadc3]")); + HWND hWnd26 = FindWindowA(0, ("MAME: Off Road Challenge (v1.10) [offroadc1]")); + + if (hWnds > NULL) { - wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); - int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - HWND hWnds = FindWindow(NULL, _T("MAME: San Francisco Rush 2049 [sf2049]")); - HWND hWnd = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (boot rom L 1.0, GUTS Oct 6 1997 / MAIN Oct 16 1997) [sfrushrk]")); - HWND hWnd1 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.0) [sfrush]")); - HWND hWnd2 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (Wavenet, boot rom L 1.38, GUTS Aug 6 1997 / MAIN Aug 5 1997) [sfrushrkwo]")); - HWND hWnd3 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Special Edition [sf2049se]")); - HWND hWnd4 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV2, World) [raveracw]")); - HWND hWnd5 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1 Ver.B, Japan) [raveracj]")); - HWND hWnd6 = FindWindowA(0, ("MAME: Rave Racer (Rev. RV1, Japan) [raveracja]")); - HWND hWnd7 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.06A) [sfrusha]")); - HWND hWnd8 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Tournament Edition [sf2049te]")); - HWND hWnd9 = FindWindowA(0, ("MAME: California Speed (Version 2.1a Apr 17 1998, GUTS 1.25 Apr 17 1998 / MAIN Apr 17 1998) [calspeed]")); - HWND hWnd10 = FindWindowA(0, ("MAME: California Speed (Version 1.0r8 Mar 10 1998, GUTS Mar 10 1998 / MAIN Mar 10 1998) [calspeeda]")); - HWND hWnd11 = FindWindowA(0, ("MAME: California Speed (Version 1.0r7a Mar 4 1998, GUTS Mar 3 1998 / MAIN Jan 19 1998) [calspeedb]")); - HWND hWnd12 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.5) [crusnwld]")); - HWND hWnd13 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.4) [crusnwld24]")); - HWND hWnd14 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.3) [crusnwld23]")); - HWND hWnd15 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.0) [crusnwld20]")); - HWND hWnd16 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.9) [crusnwld19]")); - HWND hWnd17 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.7) [crusnwld17]")); - HWND hWnd18 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.3) [crusnwld13]")); - HWND hWnd19 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.1) [crusnusa]")); - HWND hWnd20 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.0) [crusnusa40]")); - HWND hWnd21 = FindWindowA(0, ("MAME: Cruis'n USA (rev L2.1) [crusnusa21]")); - HWND hWnd22 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); - HWND hWnd23 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]")); - HWND hWnd24 = FindWindowA(0, ("MAME: Off Road Challenge (v1.40) [offroadc4]")); - HWND hWnd25 = FindWindowA(0, ("MAME: Off Road Challenge (v1.30) [offroadc3]")); - HWND hWnd26 = FindWindowA(0, ("MAME: Off Road Challenge (v1.10) [offroadc1]")); + INT_PTR ff2049 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); - if (hWnds > NULL) + if (FFBMode == 0) { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); if (FFBMode == 0) { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.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 ((ff20495 > 0x00)& (ff20495 < 0x80)) + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.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 ((ff20495 > 0x80)& (ff20495 < 0x100)) + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.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 ((ff20495 > 0x00)& (ff20495 < 0x80)) + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - else if (hWnd > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - else if (hWnd1 > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - else if (hWnd2 > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd3 > NULL) - { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - else if (hWnd7 > NULL) - { - int ffsanfranrush = 0; - { - INT_PTR ff = myHelpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); - INT_PTR ff1 = myHelpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); - INT_PTR ff2 = myHelpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); - INT_PTR ff3 = myHelpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); - UINT8 ffsan = myHelpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush - std::string ffs = std::to_string(ffsan); - myHelpers->log((char*)ffs.c_str()); - myHelpers->log("got value: "); - ffsanfranrush = sanfran(ffsan); - - if (FFBMode == 0) - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffsanfranrush > 112)& (ffsanfranrush < 233)) - { - myHelpers->log("moving wheel left"); - double percentForce = (233 - ffsanfranrush) / 119.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffsanfranrush > 0)& (ffsanfranrush < 113)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffsanfranrush) / 112.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd4 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - - if (hWnd5 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit - - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd6 > NULL) - { - int ffrave = 0; - { - INT_PTR ffrave0 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffrave1 = myHelpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ffrave2 = myHelpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); - INT_PTR ffrave3 = myHelpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); - UINT8 ffRaw = myHelpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit - - ffrave = raveracer(ffRaw); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffrave); - myHelpers->log((char*)ffs.c_str()); - } - if (FFBMode == 0) - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } - else - { - if ((ffrave > 61) && (ffrave < 124)) - { - myHelpers->log("moving wheel right"); - double percentForce = (124 - ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - else if ((ffrave > 0) && (ffrave < 62)) - { - myHelpers->log("moving wheel left"); - double percentForce = (ffrave) / 61.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd8 > NULL) - { - INT_PTR ff2049 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ff20491 = myHelpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ff20492 = myHelpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); - UINT8 ff20495 = myHelpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff20495); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ff20495 > 0x80)& (ff20495 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ff20495 > 0x00)& (ff20495 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ff20495) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd9 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); - INT_PTR ffcal4 = myHelpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); - INT_PTR ffcal5 = myHelpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd10 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0x640, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal3 + 0x104, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd11 > NULL) - { - INT_PTR ffcal1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcal2 = myHelpers->ReadIntPtr(ffcal1 + 0x388, /* isRelativeOffset*/ false); - INT_PTR ffcal3 = myHelpers->ReadIntPtr(ffcal2 + 0x640, /* isRelativeOffset*/ false); - UINT8 ffcal6 = myHelpers->ReadByte(ffcal3 + 0x104, /* isRelativeOffset */ false); //CaliforniaSpeed32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcal6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcal6 > 0x80)& (ffcal6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcal6 > 0x00)& (ffcal6 < 0x80)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcal6) / 126.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd12 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd13 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd14 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd15 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd16 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd17 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd18 > NULL) - { - int ffcrusnwld = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnwld = crusnwld(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnwld > 110)& (ffcrusnwld < 226)) - { - myHelpers->log("moving wheel left"); - double percentForce = (225 - ffcrusnwld) / 114.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnwld > 0)& (ffcrusnwld < 111)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnwld) / 110.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd19 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd20 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd21 > NULL) - { - int ffcrusnusa = 0; - { - INT_PTR ffcru1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffcru2 = myHelpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffcru3 = myHelpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffcru6 = myHelpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit - ffcrusnusa = crusnusa(ffcru6); - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffcru6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffcrusnusa > 104)& (ffcrusnusa < 215)) - { - myHelpers->log("moving wheel left"); - double percentForce = (214 - ffcrusnusa) / 109.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffcrusnusa > 0)& (ffcrusnusa < 105)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffcrusnusa) / 104.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - } - if (hWnd22 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd23 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd24 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd25 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(pow(percentForce, 0.5), 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); - } - } - } - if (hWnd26 > NULL) - { - INT_PTR ffoff1 = myHelpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); - INT_PTR ffoff2 = myHelpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); - INT_PTR ffoff3 = myHelpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); - UINT8 ffoff6 = myHelpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit - myHelpers->log("got value: "); - std::string ffs = std::to_string(ffoff6); - myHelpers->log((char*)ffs.c_str()); - - if (FFBMode == 0) - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - else - { - if ((ffoff6 > 0x83)& (ffoff6 < 0x100)) - { - myHelpers->log("moving wheel left"); - double percentForce = (255 - ffoff6) / 124.0; - double percentLength = 100; - myTriggers->Rumble(0, pow(percentForce, 0.5), percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); - } - else if ((ffoff6 > 0x00)& (ffoff6 < 0x7D)) - { - myHelpers->log("moving wheel right"); - double percentForce = (ffoff6) / 124.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 Mame0206::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 if (hWnd1 > NULL) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + else if (hWnd2 > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd3 > NULL) + { + INT_PTR ff2049 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd7 > NULL) + { + int ffsanfranrush = 0; + { + INT_PTR ff = helpers->ReadIntPtr(0x0E2B20A4, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ff + 0x134, /* isRelativeOffset*/ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x5E8, /* isRelativeOffset*/ false); + INT_PTR ff3 = helpers->ReadIntPtr(ff2 + 0x42C, /* isRelativeOffset*/ false); + UINT8 ffsan = helpers->ReadByte(ff3 + 0x550, /* isRelativeOffset */ false); //SanFranRush + std::string ffs = std::to_string(ffsan); + helpers->log((char *)ffs.c_str()); + helpers->log("got value: "); + ffsanfranrush = sanfran(ffsan); + + if (FFBMode == 0) + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush > 0) & (ffsanfranrush < 113)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush) / 112.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd4 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + + if (hWnd5 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit + + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd6 > NULL) + { + int ffrave = 0; + { + INT_PTR ffrave0 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffrave1 = helpers->ReadIntPtr(ffrave0 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ffrave2 = helpers->ReadIntPtr(ffrave1 + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ffrave3 = helpers->ReadIntPtr(ffrave2 + 0x358, /* isRelativeOffset*/ false); + UINT8 ffRaw = helpers->ReadByte(ffrave3 + 0x40, /* isRelativeOffset */ false); //Rave Racer 32bit + + ffrave = raveracer(ffRaw); + helpers->log("got value: "); + std::string ffs = std::to_string(ffrave); + helpers->log((char *)ffs.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave > 61) && (ffrave < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave > 0) && (ffrave < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave) / 61.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd8 > NULL) + { + INT_PTR ff2049 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ff20491 = helpers->ReadIntPtr(ff2049 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ff20492 = helpers->ReadIntPtr(ff20491 + 0x6C4, /* isRelativeOffset*/ false); + UINT8 ff20495 = helpers->ReadByte(ff20492 + 0x7C, /* isRelativeOffset */ false); //SanFranRush2049 + helpers->log("got value: "); + std::string ffs = std::to_string(ff20495); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff20495 > 0x80) & (ff20495 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff20495 > 0x00) & (ff20495 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff20495) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd9 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x078D624C, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0xE4, /* isRelativeOffset*/ false); + INT_PTR ffcal4 = helpers->ReadIntPtr(ffcal3 + 0x4, /* isRelativeOffset*/ false); + INT_PTR ffcal5 = helpers->ReadIntPtr(ffcal4 + 0xC, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal5 + 0x1F8, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd10 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0x640, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal3 + 0x104, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd11 > NULL) + { + INT_PTR ffcal1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcal2 = helpers->ReadIntPtr(ffcal1 + 0x388, /* isRelativeOffset*/ false); + INT_PTR ffcal3 = helpers->ReadIntPtr(ffcal2 + 0x640, /* isRelativeOffset*/ false); + UINT8 ffcal6 = helpers->ReadByte(ffcal3 + 0x104, /* isRelativeOffset */ false); //CaliforniaSpeed32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffcal6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal6 > 0x80) & (ffcal6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal6 > 0x00) & (ffcal6 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal6) / 126.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd12 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd13 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd14 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd15 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd16 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd17 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd18 > NULL) + { + int ffcrusnwld = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnwld = crusnwld(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld > 110) & (ffcrusnwld < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld) / 114.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld > 0) & (ffcrusnwld < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld) / 110.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd19 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd20 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd21 > NULL) + { + int ffcrusnusa = 0; + { + INT_PTR ffcru1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffcru2 = helpers->ReadIntPtr(ffcru1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffcru3 = helpers->ReadIntPtr(ffcru2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffcru6 = helpers->ReadByte(ffcru3 + 0x248, /* isRelativeOffset */ false); //CrusnWld32bit + ffcrusnusa = crusnusa(ffcru6); + helpers->log("got value: "); + std::string ffs = std::to_string(ffcru6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa > 104) & (ffcrusnusa < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa) / 109.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa > 0) & (ffcrusnusa < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa) / 104.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd22 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd23 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd24 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd25 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd26 > NULL) + { + INT_PTR ffoff1 = helpers->ReadIntPtr(0x02426C78, /* isRelativeOffset*/ true); + INT_PTR ffoff2 = helpers->ReadIntPtr(ffoff1 + 0x290, /* isRelativeOffset*/ false); + INT_PTR ffoff3 = helpers->ReadIntPtr(ffoff2 + 0x650, /* isRelativeOffset*/ false); + UINT8 ffoff6 = helpers->ReadByte(ffoff3 + 0x248, /* isRelativeOffset */ false); //OffRoadChallenge32bit + helpers->log("got value: "); + std::string ffs = std::to_string(ffoff6); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff6 > 0x83) & (ffoff6 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff6 > 0x00) & (ffoff6 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff6) / 124.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } } } \ No newline at end of file diff --git a/Game Files/MarioKartGPDX.cpp b/Game Files/MarioKartGPDX.cpp index fd8b78a..344bc49 100644 --- a/Game Files/MarioKartGPDX.cpp +++ b/Game Files/MarioKartGPDX.cpp @@ -13,132 +13,106 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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: "); - std::string ffs = std::to_string(ff1); - myHelpers->log((char*)ffs.c_str()); myHelpers->log("got value: "); - - - // Large Shake when hitting walls, other karts or getting hit by items - if ((4194308 == ff1) & (ff10 == 1)) - - { - double percentForce = 1.0; - double percentForce1 = 3.5; - double percentLength = (500); - myTriggers->Rumble(percentForce1, percentForce1, percentLength); - myTriggers->Sine(200, 200, percentForce); - } - - // small friction when driving on dirt while moving - else if ((3 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - { - double percentForce = (0.3); - double percentLength = (100); - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Friction(percentForce); - } - // Small constant when hitting bumps - else if ((10 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - { - double percentForce = (0.2); - double percentLength = (50); - double percentForce1 = 3.0; - myTriggers->Rumble(percentForce1, percentForce1, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - // Wheel rumbles while driving on grass - else if ((4 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - - { - double percentForce = 0.2; - double percentLength = (50); - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->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); - } - //Wheel rumbles lightly when driving over tiles - else if ((12 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - - { - double percentForce = 0.1; - double percentForce1 = 0.2; - double percentLength = (150); - myTriggers->Rumble(percentForce1, 0, percentLength); - myTriggers->Sine(70, 70, percentForce); - } - //Wheel rumbles lightly when driving over sand - else if ((14 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - - { - double percentForce = 0.1; - double percentForce1 = 0.2; - double percentLength = (50); - myTriggers->Rumble(percentForce1, 0, percentLength); - myTriggers->Sine(70, 70, percentForce); - } - //Wheel rumbles lightly when driving over rough part of track - else if ((11 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - - { - double percentForce = 0.1; - double percentForce1 = 0.2; - double percentLength = (250); - myTriggers->Rumble(0, percentForce1, percentLength); - myTriggers->Sine(40, 50, percentForce); - } - //Wheel rumbles moderately when driving over wooden bridges - else if ((8 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) - - { - 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) { + 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); + helpers->log((char *)ffs.c_str()); helpers->log("got value: "); - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); + // Large Shake when hitting walls, other karts or getting hit by items + if ((4194308 == ff1) & (ff10 == 1)) - while (SDL_WaitEvent(&e) != 0) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + double percentForce = 1.0; + double percentForce1 = 3.5; + double percentLength = (500); + triggers->Rumble(percentForce1, percentForce1, percentLength); + triggers->Sine(200, 200, percentForce); + } + + // small friction when driving on dirt while moving + else if ((3 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) + { + double percentForce = (0.3); + double percentLength = (100); + triggers->Rumble(percentForce, 0, percentLength); + triggers->Friction(percentForce); + } + // Small constant when hitting bumps + else if ((10 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) + { + double percentForce = (0.2); + double percentLength = (50); + double percentForce1 = 3.0; + 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)) + + { + double percentForce = 0.2; + double percentLength = (50); + 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); + triggers->Friction(percentForce); + } + //Wheel rumbles lightly when driving over tiles + else if ((12 == ff3) & (ff10 == 1) & (ff5 == 1) & (ff11 == 1065353216)) + + { + double percentForce = 0.1; + double percentForce1 = 0.2; + double percentLength = (150); + 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)) + + { + double percentForce = 0.1; + double percentForce1 = 0.2; + double percentLength = (50); + 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)) + + { + double percentForce = 0.1; + double percentForce1 = 0.2; + double percentLength = (250); + 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)) + + { + double percentForce = 0.4; + double percentLength = (100); + triggers->Rumble(percentForce, percentForce, percentLength); + triggers->Sine(120, 120, percentForce); + } } \ No newline at end of file diff --git a/Game Files/MarioKartGPDX.h b/Game Files/MarioKartGPDX.h index 2a0e60f..ae3b66d 100644 --- a/Game Files/MarioKartGPDX.h +++ b/Game Files/MarioKartGPDX.h @@ -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); diff --git a/Game Files/MarioKartGPDX1.10.cpp b/Game Files/MarioKartGPDX1.10.cpp index 8b12479..6bd694b 100644 --- a/Game Files/MarioKartGPDX1.10.cpp +++ b/Game Files/MarioKartGPDX1.10.cpp @@ -49,222 +49,194 @@ 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; - -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 static oldcoins = 0; - int newcoins = ff13; - int static oldweapon = 0; - int newweapon = ff14; - int static oldhitground = 0; - int newhitground = ff5; - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff1); - myHelpers->log((char*)ffs.c_str()); myHelpers->log("got value: "); - - if ((ConstantEffectForSteering == 1) && (ff11 == 1)) - { - if ((Wheel >= 0) & (Wheel < 128)) - { - double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0)); - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - 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); - } - } - if ((MainShakeRumble == 1) & (4194308 == ff1) & (ff11 == 1)) - { - // 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); - } - 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); - } - 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); - } - 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); - } - 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); - Sleep(50); - myTriggers->Constant(myConstants->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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - oldcoins = newcoins; - oldweapon = newweapon; - oldhitground = newhitground; - } - return 0; -} - void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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 - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + int static oldcoins = 0; + int newcoins = ff13; + int static oldweapon = 0; + int newweapon = ff14; + int static oldhitground = 0; + int newhitground = ff5; + helpers->log("got value: "); + std::string ffs = std::to_string(ff1); + helpers->log((char *)ffs.c_str()); helpers->log("got value: "); + + if ((ConstantEffectForSteering == 1) && (ff11 == 1)) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + if ((Wheel >= 0) & (Wheel < 128)) + { + double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0)); + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((Wheel > 127) & (Wheel < 256)) + { + double percentForce = ((Wheel - 127) / (ConstantEffectForSteeringStrength / 1.0)); + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } } + if ((MainShakeRumble == 1) & (4194308 == ff1) & (ff11 == 1)) + { + // Large Shake when hitting walls, other karts or getting hit by items + double percentForce = ((MainShakeRumbleStrength) / 100.0); + double percentLength = (500); + 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); + 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); + triggers->Rumble(percentForce, 0, percentLength); + triggers->Friction(percentForce); + } + 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); + 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); + triggers->Rumble(percentForce, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + Sleep(50); + 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); + 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); + 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); + 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); + 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); + 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); + 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)) + { + //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); + triggers->Rumble(percentForce1, 0, percentLength); + triggers->Friction(percentForce); + } + 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); + 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); + 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); + 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); + 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); + triggers->Rumble(percentForce, percentForce, percentLength); + triggers->Sine(120, 120, percentForce); + } + oldcoins = newcoins; + oldweapon = newweapon; + oldhitground = newhitground; } \ No newline at end of file diff --git a/Game Files/MarioKartGPDX1.10.h b/Game Files/MarioKartGPDX1.10.h index cf48747..1a2725b 100644 --- a/Game Files/MarioKartGPDX1.10.h +++ b/Game Files/MarioKartGPDX1.10.h @@ -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); diff --git a/Game Files/OutRun2Fake.cpp b/Game Files/OutRun2Fake.cpp index 30ea696..0e2da33 100644 --- a/Game Files/OutRun2Fake.cpp +++ b/Game Files/OutRun2Fake.cpp @@ -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); diff --git a/Game Files/OutRun2Real.cpp b/Game Files/OutRun2Real.cpp index bba4498..4330ebf 100644 --- a/Game Files/OutRun2Real.cpp +++ b/Game Files/OutRun2Real.cpp @@ -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); @@ -95,16 +94,6 @@ static int RunningThread(void *ptr) float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo 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)) { @@ -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; diff --git a/Game Files/PokkenTournament.cpp b/Game Files/PokkenTournament.cpp index 73e98df..932c6d5 100644 --- a/Game Files/PokkenTournament.cpp +++ b/Game Files/PokkenTournament.cpp @@ -13,79 +13,52 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "PokkenTournament.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 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 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); - - float static oldFloat = 0.0; - float newFloat = ff3; - - myHelpers->log("got value: "); - std::string ffs = std::to_string(ff3); - myHelpers->log((char*)ffs.c_str()); - - - if ((oldFloat != newFloat)) - { - if (HowtoRumble == 0) - { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - myTriggers->Rumble(percentForce, percentForce, percentLength); - } - else if (HowtoRumble == 1) - { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - myTriggers->Rumble(0, percentForce, percentLength); - } - else if (HowtoRumble == 2) - { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - myTriggers->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); + 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 - while (SDL_WaitEvent(&e) != 0) + 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); + + float static oldFloat = 0.0; + float newFloat = ff3; + + helpers->log("got value: "); + std::string ffs = std::to_string(ff3); + helpers->log((char *)ffs.c_str()); + + + if ((oldFloat != newFloat)) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + if (HowtoRumble == 0) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->Rumble(percentForce, percentForce, percentLength); + } + else if (HowtoRumble == 1) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->Rumble(0, percentForce, percentLength); + } + else if (HowtoRumble == 2) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->Rumble(percentForce, 0, percentLength); + } + } + oldFloat = newFloat; } \ No newline at end of file diff --git a/Game Files/PokkenTournament.h b/Game Files/PokkenTournament.h index 0b5a2d5..8da1cdf 100644 --- a/Game Files/PokkenTournament.h +++ b/Game Files/PokkenTournament.h @@ -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); diff --git a/Game Files/RoadFighters3D.cpp b/Game Files/RoadFighters3D.cpp index 6fb729d..98cdfb5 100644 --- a/Game Files/RoadFighters3D.cpp +++ b/Game Files/RoadFighters3D.cpp @@ -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; diff --git a/Game Files/SegaRacingClassic.cpp b/Game Files/SegaRacingClassic.cpp index c0bc834..9ccc401 100644 --- a/Game Files/SegaRacingClassic.cpp +++ b/Game Files/SegaRacingClassic.cpp @@ -13,121 +13,93 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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: "); - std::string ffs = std::to_string(ff); - myHelpers->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)) - { - //Clutch - double percentForce = (224 - ff) / 8.0; - double percentLength = 100; - myTriggers->Friction(percentForce); - } - else if ((ff > 0xBF)& (ff < 0xC8)) - { - //Centering - double percentForce = (200 - ff) / 8.0; - double percentLength = 100; - myTriggers->Spring(pow(percentForce, 0.1)); - } - else if ((ff > 0xB7)& (ff < 0xC0)) - { - //Uncentering - double percentForce = (192 - ff) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, percentForce); - } - 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); - } - 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); - } - } - else - { - if ((ff > 0xD7)& (ff < 0xE0)) - { - //Clutch - double percentForce = (224 - ff) / 8.0; - double percentLength = 100; - myTriggers->Friction(pow(percentForce, 0.5)); - } - else if ((ff > 0xBF)& (ff < 0xC8)) - { - //Centering - double percentForce = (200 - ff) / 8.0; - double percentLength = 100; - myTriggers->Spring(pow(percentForce, 0.1)); - } - else if ((ff > 0xB7)& (ff < 0xC0)) - { - //Uncentering - double percentForce = (192 - ff) / 8.0; - double percentLength = 100; - myTriggers->Sine(70, 80, pow(percentForce, 0.5)); - } - 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))); - } - 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))); - } - } - } - return 0; -} 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); + helpers->log((char *)ffs.c_str()); + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); - 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; - } + if (FFBMode == 0) + { + if ((ff > 0xD7) & (ff < 0xE0)) + { + //Clutch + double percentForce = (224 - ff) / 8.0; + double percentLength = 100; + triggers->Friction(percentForce); + } + else if ((ff > 0xBF) & (ff < 0xC8)) + { + //Centering + double percentForce = (200 - ff ) / 8.0; + double percentLength = 100; + triggers->Spring(pow(percentForce, 0.1)); + } + else if ((ff > 0xB7) & (ff < 0xC0)) + { + //Uncentering + double percentForce = (192 - ff) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, percentForce); + } + else if ((ff > 0xA7) & (ff < 0xB0)) + { + //Roll Left + double percentForce = (176 - ff) / 8.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x97) & (ff < 0xA0)) + { + //Roll Right + double percentForce = (160 - ff) / 8.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff > 0xD7) & (ff < 0xE0)) + { + //Clutch + double percentForce = (224 - ff) / 8.0; + double percentLength = 100; + triggers->Friction(pow(percentForce, 0.5)); + } + else if ((ff > 0xBF) & (ff < 0xC8)) + { + //Centering + double percentForce = (200 - ff) / 8.0; + double percentLength = 100; + triggers->Spring(pow(percentForce, 0.1)); + } + else if ((ff > 0xB7) & (ff < 0xC0)) + { + //Uncentering + double percentForce = (192 - ff) / 8.0; + double percentLength = 100; + triggers->Sine(70, 80, pow(percentForce, 0.5)); + } + else if ((ff > 0xA7) & (ff < 0xB0)) + { + //Roll Left + double percentForce = (176 - ff) / 8.0; + double percentLength = 100; + triggers->Rumble(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x97) & (ff < 0xA0)) + { + //Roll Right + double percentForce = (160 - ff) / 8.0; + double percentLength = 100; + triggers->Rumble(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } } \ No newline at end of file diff --git a/Game Files/SegaRacingClassic.h b/Game Files/SegaRacingClassic.h index fa5baf6..3952a3b 100644 --- a/Game Files/SegaRacingClassic.h +++ b/Game Files/SegaRacingClassic.h @@ -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); diff --git a/Game Files/SegaRally3.cpp b/Game Files/SegaRally3.cpp index f9e1119..5da0689 100644 --- a/Game Files/SegaRally3.cpp +++ b/Game Files/SegaRally3.cpp @@ -13,73 +13,40 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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"); - const int ff = GetTeknoParrotFFB(); - std::string ffs = std::to_string(ff); - myHelpers->log((char*)ffs.c_str()); - - if (ff > 15) - { - myHelpers->log("moving wheel right"); - double percentForce = (31 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - else if (ff > 0) - { - myHelpers->log("moving wheel left"); - double percentForce = (16 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - } -} 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); + helpers->log((char *)ffs.c_str()); - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - - TeknoParrotGame(); - - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) + if (ff > 15) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; - } + helpers->log("moving wheel right"); + // assume that 30 is the weakest and 16 is the strongest + double percentForce = (31 - ff) / 15.0; + double percentLength = 100; + // direction from left => makes wheel turn right + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + lastWasStop = 0; + } + else if (ff > 0) + { + helpers->log("moving wheel left"); + // assume that 1 is the strongest and 15 is the weakest + double percentForce = (16 - ff) / 15.0; + double percentLength = 100; + // direction from right => makes wheel turn left + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } + } } \ No newline at end of file diff --git a/Game Files/SegaRally3.h b/Game Files/SegaRally3.h index 88fbf8c..c672d92 100644 --- a/Game Files/SegaRally3.h +++ b/Game Files/SegaRally3.h @@ -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); }; \ No newline at end of file diff --git a/Game Files/SonicSegaAllStarsRacing.cpp b/Game Files/SonicSegaAllStarsRacing.cpp index e43d354..082866c 100644 --- a/Game Files/SonicSegaAllStarsRacing.cpp +++ b/Game Files/SonicSegaAllStarsRacing.cpp @@ -13,64 +13,44 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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); - - { - //Enable FFB - myHelpers->WriteByte(0x5CD858, 0x03, true); - } - - { - //Trigger friction to stop any oscillation - double percentForce = 0.2; - myTriggers->Friction(percentForce); - } - - if ((FFB > 0)& (FFB < 19)) - { - myHelpers->log("moving wheel right"); - double percentForce = (FFB) / 18.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if ((FFB > 237)& (FFB < 256)) - { - myHelpers->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); - } - } - return 0; -} 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); - 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; + //Enable FFB + helpers->WriteByte(0x5CD858, 0x03, true); + } + { + //Trigger friction to stop any oscillation + double percentForce = 0.2; + triggers->Friction(percentForce); + } + if ((FFB > 0) & (FFB < 19)) + { + helpers->log("moving wheel right"); + double percentForce = (FFB) / 18.0; + double percentLength = 100; + triggers->Rumble(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + lastWasStop = 0; + + } + else if ((FFB > 237) & (FFB < 256)) + { + helpers->log("moving wheel right"); + double percentForce = (256 - FFB) / 18.0; + double percentLength = 100; + triggers->Rumble(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } } } diff --git a/Game Files/SonicSegaAllStarsRacing.h b/Game Files/SonicSegaAllStarsRacing.h index d1e7fd5..b1005bc 100644 --- a/Game Files/SonicSegaAllStarsRacing.h +++ b/Game Files/SonicSegaAllStarsRacing.h @@ -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); diff --git a/Game Files/TestGame.h b/Game Files/TestGame.h index e9215e3..0f6d864 100644 --- a/Game Files/TestGame.h +++ b/Game Files/TestGame.h @@ -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); diff --git a/Game Files/WMMT5.cpp b/Game Files/WMMT5.cpp index 9dbd3f2..86885df 100644 --- a/Game Files/WMMT5.cpp +++ b/Game Files/WMMT5.cpp @@ -136,197 +136,178 @@ 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; - 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); - 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()); - - double percentForce; - if (0.001 > spring && !gameFfbStarted) - { - myHelpers->log("fake spring+friction until game's FFB starts"); - percentForce = 0.3 * SpringStrength / 100.0; - myTriggers->Spring(percentForce); - percentForce = 0.5 * FrictionStrength / 100.0; - myTriggers->Friction(percentForce); - } - else - { - if (!gameFfbStarted) - { - myHelpers->log("game's FFB started"); - gameFfbStarted = true; - } - percentForce = (1.0 * spring) * SpringStrength / 100.0; - myTriggers->Spring(percentForce); - percentForce = (1.0 * friction) * FrictionStrength / 100.0; - myTriggers->Friction(percentForce); - } - - if (0 < collisions) - { - if (0.209 <= collisions && 0.311 >= collisions) - { - myHelpers->log("joint/stripe on the right"); - percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; - myTriggers->Sine(80, 80, percentForce); - myTriggers->Rumble(0, percentForce, 150); - } - else - { - myHelpers->log("collision on the right"); - percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - myTriggers->Rumble(0, percentForce, 150); - } - } - else if (0 > collisions) - { - if (-0.209 >= collisions && -0.311 <= collisions) - { - myHelpers->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); - } - else - { - myHelpers->log("collision on the left"); - percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - myTriggers->Rumble(0, percentForce, 150); - } - } - else - { - myHelpers->log("resetting collision"); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, 0); - } - - if (0 < tiresSlip) - { - myHelpers->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); - - if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) - { - myTriggers->Rumble(0, -1.0 * percentForce, 150); - } - } - else if (0 > tiresSlip) - { - myHelpers->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); - - if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) - { - myTriggers->Rumble(0, percentForce, 150); - } - } - - INT_PTR ptr1 = myHelpers->ReadIntPtr(0x199A450, true); - UINT8 gear = myHelpers->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 diff = 0x0A <= power ? 0 : 20; - - if ( - 1 == gear && 10 < speed && ( - ((30 - diff) > speed && 3500 < rpm) - || ((55 - diff) > speed && 5500 < rpm) - || ((75 - diff) > speed && 7000 < rpm) - || ((100 - diff) > speed && 7800 < rpm) - ) - ) - { - 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); - - 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()); - } - else if ( - 2 == gear && 10 < speed && ( - ((110 - (2 * diff)) > speed && 5000 < rpm) - || ((130 - (2 * diff)) > speed && 6000 < rpm) - || ((145 - (2 * diff)) > speed && 6500 < rpm) - || ((160 - (2 * diff)) > speed && 7000 < rpm) - ) - ) - { - 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); - - 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()); - } - } - - if (0 < GearChangeStrength) - { - ptr1 = myHelpers->ReadIntPtr(0x199A468, true); - float time = myHelpers->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()); - } - - if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed) - { - SDL_CreateThread(GearChangeThread, "GearChangeThread", (void*)NULL); - } - 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) + if (!init) { + init = true; myTriggers = triggers; myConstants = constants; myHelpers = helpers; - } + SDL_CreateThread(InputThread, "InputThread", (void*)NULL); + SDL_CreateThread(SpamThread, "SpamThread", (void*)NULL); + } + + 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); + helpers->log((char*)msg.c_str()); + + double percentForce; + if (0.001 > spring && !gameFfbStarted) + { + helpers->log("fake spring+friction until game's FFB starts"); + percentForce = 0.3 * SpringStrength / 100.0; + triggers->Spring(percentForce); + percentForce = 0.5 * FrictionStrength / 100.0; + triggers->Friction(percentForce); + } + else + { + if (!gameFfbStarted) + { + helpers->log("game's FFB started"); + gameFfbStarted = true; + } + percentForce = (1.0 * spring) * SpringStrength / 100.0; + triggers->Spring(percentForce); + percentForce = (1.0 * friction) * FrictionStrength / 100.0; + triggers->Friction(percentForce); + } + + if (0 < collisions) + { + if (0.209 <= collisions && 0.311 >= collisions) + { + helpers->log("joint/stripe on the right"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, percentForce, 150); + } + else + { + helpers->log("collision on the right"); + percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + triggers->Rumble(0, percentForce, 150); + } + } + else if (0 > collisions) + { + if (-0.209 >= collisions && -0.311 <= collisions) + { + helpers->log("joint/stripe on the left"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, -1.0 * percentForce, 150); + } + else + { + helpers->log("collision on the left"); + percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + triggers->Rumble(0, percentForce, 150); + } + } + else + { + helpers->log("resetting collision"); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + } + + if (0 < tiresSlip) + { + helpers->log("tires slip left"); + bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, -1.0 * percentForce, 150); + } + } + else if (0 > tiresSlip) + { + helpers->log("tires slip right"); + bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, percentForce, 150); + } + } + + 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 = helpers->ReadInt32(0x1970038, true); + int diff = 0x0A <= power ? 0 : 20; + + if ( + 1 == gear && 10 < speed && ( + ((30 - diff) > speed && 3500 < rpm) + || ((55 - diff) > speed && 5500 < rpm) + || ((75 - diff) > speed && 7000 < rpm) + || ((100 - diff) > speed && 7800 < rpm) + ) + ) + { + percentForce = (((100.0 - speed) / 100.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0; + 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); + helpers->log((char*)msg.c_str()); + } + else if ( + 2 == gear && 10 < speed && ( + ((110 - (2 * diff)) > speed && 5000 < rpm) + || ((130 - (2 * diff)) > speed && 6000 < rpm) + || ((145 - (2 * diff)) > speed && 6500 < rpm) + || ((160 - (2 * diff)) > speed && 7000 < rpm) + ) + ) + { + percentForce = (((160.0 - speed) / 150.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0; + 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); + helpers->log((char*)msg.c_str()); + } + } + + if (0 < GearChangeStrength) + { + 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); + helpers->log((char*)msg.c_str()); + } + + if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed) + { + SDL_CreateThread(GearChangeThread, "GearChangeThread", (void*)NULL); + } + oldgear = gear; + } } \ No newline at end of file diff --git a/Game Files/WMMT5.h b/Game Files/WMMT5.h index b9b34f3..da1dabb 100644 --- a/Game Files/WMMT5.h +++ b/Game Files/WMMT5.h @@ -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); diff --git a/Game Files/WackyRaces.cpp b/Game Files/WackyRaces.cpp index d179b2a..8941ee6 100644 --- a/Game Files/WackyRaces.cpp +++ b/Game Files/WackyRaces.cpp @@ -13,11 +13,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #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,58 +83,53 @@ int ttx2wr(int ffRaw) { } } -static int RunningThread(void* ptr) -{ - int cnt; - for (cnt = 0; cnt >= 0; ++cnt) - { - int ff = 0; - - { - long ffAddress = myHelpers->ReadInt32(0x7E00590, /* isRelativeOffset*/ true); - int ffRaw = myHelpers->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]) { - ffRaw -= lampArray[i]; - } - }; - ff = ttx2wr(ffRaw); - } - - if (ff > 15) - { - myHelpers->log("moving wheel left"); - double percentForce = (31 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(0, percentForce, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); - } - else if (ff > 0) - { - myHelpers->log("moving wheel right"); - double percentForce = (16 - ff) / 15.0; - double percentLength = 100; - myTriggers->Rumble(percentForce, 0, percentLength); - myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); - } - } - return 0; -} - void WackyRaces::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + int ff = 0; - SDL_Thread* thread; - thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL); - - while (SDL_WaitEvent(&e) != 0) { - myTriggers = triggers; - myConstants = constants; - myHelpers = helpers; + 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]) { + ffRaw -= lampArray[i]; + } + }; + ff = ttx2wr(ffRaw); + } + + //helpers->log("got value: "); + //std::string ffs = std::to_string(ff); + //helpers->log((char *)ffs.c_str()); + + if (ff > 15) + { + 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; + // 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) + { + 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; + // 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; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } } } \ No newline at end of file diff --git a/Game Files/WackyRaces.h b/Game Files/WackyRaces.h index 4651f51..21b5729 100644 --- a/Game Files/WackyRaces.h +++ b/Game Files/WackyRaces.h @@ -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);