From 65747e84b8ae8f1fd42cf2b2806ebefab2c4cc97 Mon Sep 17 00:00:00 2001 From: Aaron M Date: Sun, 7 Apr 2019 17:16:19 +1200 Subject: [PATCH] 0.8 update --- Common Files/Game.cpp | 125 + Common Files/Game.h | 98 + Common Files/TeknoParrotGame.cpp | 17 + Common Files/TeknoParrotGame.h | 18 + Config/FFBPlugin.ini | 442 ++ DLLWrapper.asm | 668 +++ Dinput8Wrapper.sln | 33 + Dinput8Wrapper.vcxproj | 374 ++ Dinput8Wrapper.vcxproj.filters | 248 + Dinput8Wrapper.vcxproj.user | 6 + DllMain.cpp | 2399 ++++++++ Game Files/AfterburnerClimax.cpp | 27 + Game Files/AfterburnerClimax.h | 7 + Game Files/BG4JP.cpp | 155 + Game Files/BG4JP.h | 8 + Game Files/ButtonRumble32bit.cpp | 318 ++ Game Files/ButtonRumble32bit.h | 7 + Game Files/ButtonRumble64bit.cpp | 318 ++ Game Files/ButtonRumble64bit.h | 7 + Game Files/ChaseHQ2.cpp | 124 + Game Files/ChaseHQ2.h | 8 + Game Files/Daytona3.cpp | 277 + Game Files/Daytona3.h | 8 + Game Files/Demul.cpp | 161 + Game Files/Demul.h | 7 + Game Files/FNF.cpp | 6 + Game Files/FNF.h | 8 + Game Files/FordRacing.cpp | 42 + Game Files/FordRacing.h | 8 + Game Files/GTIClub3.cpp | 68 + Game Files/GTIClub3.h | 7 + Game Files/InitialD4.cpp | 47 + Game Files/InitialD4.h | 7 + Game Files/InitialD4Japan.cpp | 46 + Game Files/InitialD4Japan.h | 7 + Game Files/InitialD5.cpp | 46 + Game Files/InitialD5.h | 7 + Game Files/InitialD6.cpp | 93 + Game Files/InitialD6.h | 8 + Game Files/InitialD7.cpp | 93 + Game Files/InitialD7.h | 8 + Game Files/InitialD8.cpp | 93 + Game Files/InitialD8.h | 8 + Game Files/LGI.cpp | 258 + Game Files/LGI.h | 7 + Game Files/LGI3D.cpp | 343 ++ Game Files/LGI3D.h | 7 + Game Files/M2Emulator.cpp | 6062 ++++++++++++++++++++ Game Files/M2Emulator.h | 7 + Game Files/Machstorm.cpp | 197 + Game Files/Machstorm.h | 8 + Game Files/Mame019932bit.cpp | 3163 +++++++++++ Game Files/Mame019932bit.h | 7 + Game Files/Mame019964bit.cpp | 6559 ++++++++++++++++++++++ Game Files/Mame019964bit.h | 7 + Game Files/Mame020632bit.cpp | 3116 ++++++++++ Game Files/Mame020632bit.h | 7 + Game Files/Mame020664bit.cpp | 5903 +++++++++++++++++++ Game Files/Mame020664bit.h | 7 + Game Files/MarioKartGPDX.cpp | 105 + Game Files/MarioKartGPDX.h | 8 + Game Files/MarioKartGPDX1.10.cpp | 230 + Game Files/MarioKartGPDX1.10.h | 8 + Game Files/OutRun2Fake.cpp | 462 ++ Game Files/OutRun2Fake.h | 7 + Game Files/OutRun2Real.cpp | 62 + Game Files/OutRun2Real.h | 7 + Game Files/PokkenTournament.cpp | 51 + Game Files/PokkenTournament.h | 8 + Game Files/RoadFighters3D.cpp | 1226 ++++ Game Files/RoadFighters3D.h | 7 + Game Files/SegaRacingClassic.cpp | 92 + Game Files/SegaRacingClassic.h | 8 + Game Files/SegaRally3.cpp | 39 + Game Files/SegaRally3.h | 8 + Game Files/SonicSegaAllStarsRacing.cpp | 43 + Game Files/SonicSegaAllStarsRacing.h | 8 + Game Files/TestGame.cpp | 40 + Game Files/TestGame.h | 8 + Game Files/WMMT5.cpp | 57 + Game Files/WMMT5.h | 8 + Game Files/WackyRaces.cpp | 122 + Game Files/WackyRaces.h | 9 + IDirectInputDevice.cpp | 225 + IDirectInputDevice.h | 54 + Includes/FFBPlugin.txt | 417 ++ Post-Build/build.js | 78 + Post-Build/copydlls.bat | 5 + Post-Build/node_modules/ini/LICENSE | 15 + Post-Build/node_modules/ini/README.md | 102 + Post-Build/node_modules/ini/ini.js | 194 + Post-Build/node_modules/ini/package.json | 66 + Post-Build/package-lock.json | 13 + Post-Build/package.json | 14 + README.md | 3 + dinput8.def | 658 +++ packages.config | 5 + 97 files changed, 36592 insertions(+) create mode 100644 Common Files/Game.cpp create mode 100644 Common Files/Game.h create mode 100644 Common Files/TeknoParrotGame.cpp create mode 100644 Common Files/TeknoParrotGame.h create mode 100644 Config/FFBPlugin.ini create mode 100644 DLLWrapper.asm create mode 100644 Dinput8Wrapper.sln create mode 100644 Dinput8Wrapper.vcxproj create mode 100644 Dinput8Wrapper.vcxproj.filters create mode 100644 Dinput8Wrapper.vcxproj.user create mode 100644 DllMain.cpp create mode 100644 Game Files/AfterburnerClimax.cpp create mode 100644 Game Files/AfterburnerClimax.h create mode 100644 Game Files/BG4JP.cpp create mode 100644 Game Files/BG4JP.h create mode 100644 Game Files/ButtonRumble32bit.cpp create mode 100644 Game Files/ButtonRumble32bit.h create mode 100644 Game Files/ButtonRumble64bit.cpp create mode 100644 Game Files/ButtonRumble64bit.h create mode 100644 Game Files/ChaseHQ2.cpp create mode 100644 Game Files/ChaseHQ2.h create mode 100644 Game Files/Daytona3.cpp create mode 100644 Game Files/Daytona3.h create mode 100644 Game Files/Demul.cpp create mode 100644 Game Files/Demul.h create mode 100644 Game Files/FNF.cpp create mode 100644 Game Files/FNF.h create mode 100644 Game Files/FordRacing.cpp create mode 100644 Game Files/FordRacing.h create mode 100644 Game Files/GTIClub3.cpp create mode 100644 Game Files/GTIClub3.h create mode 100644 Game Files/InitialD4.cpp create mode 100644 Game Files/InitialD4.h create mode 100644 Game Files/InitialD4Japan.cpp create mode 100644 Game Files/InitialD4Japan.h create mode 100644 Game Files/InitialD5.cpp create mode 100644 Game Files/InitialD5.h create mode 100644 Game Files/InitialD6.cpp create mode 100644 Game Files/InitialD6.h create mode 100644 Game Files/InitialD7.cpp create mode 100644 Game Files/InitialD7.h create mode 100644 Game Files/InitialD8.cpp create mode 100644 Game Files/InitialD8.h create mode 100644 Game Files/LGI.cpp create mode 100644 Game Files/LGI.h create mode 100644 Game Files/LGI3D.cpp create mode 100644 Game Files/LGI3D.h create mode 100644 Game Files/M2Emulator.cpp create mode 100644 Game Files/M2Emulator.h create mode 100644 Game Files/Machstorm.cpp create mode 100644 Game Files/Machstorm.h create mode 100644 Game Files/Mame019932bit.cpp create mode 100644 Game Files/Mame019932bit.h create mode 100644 Game Files/Mame019964bit.cpp create mode 100644 Game Files/Mame019964bit.h create mode 100644 Game Files/Mame020632bit.cpp create mode 100644 Game Files/Mame020632bit.h create mode 100644 Game Files/Mame020664bit.cpp create mode 100644 Game Files/Mame020664bit.h create mode 100644 Game Files/MarioKartGPDX.cpp create mode 100644 Game Files/MarioKartGPDX.h create mode 100644 Game Files/MarioKartGPDX1.10.cpp create mode 100644 Game Files/MarioKartGPDX1.10.h create mode 100644 Game Files/OutRun2Fake.cpp create mode 100644 Game Files/OutRun2Fake.h create mode 100644 Game Files/OutRun2Real.cpp create mode 100644 Game Files/OutRun2Real.h create mode 100644 Game Files/PokkenTournament.cpp create mode 100644 Game Files/PokkenTournament.h create mode 100644 Game Files/RoadFighters3D.cpp create mode 100644 Game Files/RoadFighters3D.h create mode 100644 Game Files/SegaRacingClassic.cpp create mode 100644 Game Files/SegaRacingClassic.h create mode 100644 Game Files/SegaRally3.cpp create mode 100644 Game Files/SegaRally3.h create mode 100644 Game Files/SonicSegaAllStarsRacing.cpp create mode 100644 Game Files/SonicSegaAllStarsRacing.h create mode 100644 Game Files/TestGame.cpp create mode 100644 Game Files/TestGame.h create mode 100644 Game Files/WMMT5.cpp create mode 100644 Game Files/WMMT5.h create mode 100644 Game Files/WackyRaces.cpp create mode 100644 Game Files/WackyRaces.h create mode 100644 IDirectInputDevice.cpp create mode 100644 IDirectInputDevice.h create mode 100644 Includes/FFBPlugin.txt create mode 100644 Post-Build/build.js create mode 100644 Post-Build/copydlls.bat create mode 100644 Post-Build/node_modules/ini/LICENSE create mode 100644 Post-Build/node_modules/ini/README.md create mode 100644 Post-Build/node_modules/ini/ini.js create mode 100644 Post-Build/node_modules/ini/package.json create mode 100644 Post-Build/package-lock.json create mode 100644 Post-Build/package.json create mode 100644 README.md create mode 100644 dinput8.def create mode 100644 packages.config diff --git a/Common Files/Game.cpp b/Common Files/Game.cpp new file mode 100644 index 0000000..1e40643 --- /dev/null +++ b/Common Files/Game.cpp @@ -0,0 +1,125 @@ +#include +#include +#include +#include +#include "Game.h" + +typedef unsigned char U8; + +bool Helpers::fileExists(char *filename) +{ + std::ifstream ifile(filename); + return !ifile.fail(); +} + +void Helpers::log(char *msg) { + if (enableLogging == 0) { return; } + std::ofstream ofs("FFBlog.txt", std::ofstream::app); + ofs << msg << std::endl; + ofs.close(); +} + +void Helpers::logInt(int value) { + std::string njs = std::to_string(value); + log((char *)njs.c_str()); +} + +void Helpers::logInit(char *msg) { + if (enableLogging == 0) { return; } + std::ofstream ofs("FFBlog.txt", std::ofstream::out); + ofs << msg << std::endl; + ofs.close(); +} + +// reading memory +LPVOID Helpers::GetTranslatedOffset(INT_PTR offset) +{ + return reinterpret_cast((INT_PTR)GetModuleHandle(NULL) + offset); +} + +UINT8 Helpers::ReadByte(INT_PTR offset, bool isRelativeOffset) +{ + UINT8 val = 0; + SIZE_T read; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + ReadProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(UINT8), &read); + return val; +} + +float Helpers::WriteFloat32(INT_PTR offset, float val, bool isRelativeOffset) +{ + //val = 0.0f; + SIZE_T written; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + WriteProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(float), &written); + return val; +}; + +UINT8 Helpers::WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset) +{ + SIZE_T written; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + WriteProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(UINT8), &written); + return val; +} + +INT_PTR Helpers::WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset) +{ + SIZE_T written; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + WriteProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(INT_PTR), &written); + return val; +}; + +UINT8 Helpers::WriteNop(INT_PTR offset, bool isRelativeOffset) +{ + U8 nop = 0x90; + SIZE_T written; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + WriteProcessMemory(GetCurrentProcess(), trueOffset, &nop, 1, &written); + return nop; +} + +int Helpers::ReadInt32(INT_PTR offset, bool isRelativeOffset) +{ + int val = 0; + SIZE_T read; + //log("going to try to RPM"); + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + ReadProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(int), &read); + //log("RPM"); + //char text[256]; + //sprintf_s(text, "%16X / %16X\n", offset, trueOffset); + //log(text); + return val; +} + +INT_PTR Helpers::ReadIntPtr(INT_PTR offset, bool isRelativeOffset) +{ + SIZE_T read; + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + INT_PTR val; + ReadProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(INT_PTR), &read); + return val; +}; + +float Helpers::ReadFloat32(INT_PTR offset, bool isRelativeOffset) +{ + + float val = 0.0f; + SIZE_T read; + //log("going to try to RPM"); + LPVOID trueOffset = (isRelativeOffset ? GetTranslatedOffset(offset) : (LPVOID)offset); + ReadProcessMemory(GetCurrentProcess(), trueOffset, &val, sizeof(float), &read); + //char text[256]; + //sprintf_s(text, "%16X / %16X\n", offset, trueOffset); + //log(text); + //log("RPM"); + return val; + +}; + +void Game::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) +{ + return; +} diff --git a/Common Files/Game.h b/Common Files/Game.h new file mode 100644 index 0000000..1094928 --- /dev/null +++ b/Common Files/Game.h @@ -0,0 +1,98 @@ +#pragma once +#include +// struct +struct EffectTriggers { + void(*Constant)(int direction, double strength); + void(*Spring)(double strength); + void(*Friction)(double strength); + void(*Sine)(UINT16 period, UINT16 fadePeriod, double strength); + void(*Rumble)(double strength, double length); + void(*LeftRight)(double smallstrength, double largestrength, double length); + void(*LeftRightDevice2)(double smallstrength, double largestrength, double length); + void(*Springi)(double strength); +}; + +// classes +class EffectCollection { +public: + int effect_id = 0; + int effect_left_id = 0; + int effect_right_id = 0; + int effect_friction_id = 0; + int effect_leftright_id = 0; + int effect_sine_id = 0; + int effect_spring_id = 0; + int effect_vibration_id = 0; +}; + +class EffectConstants { +public: + // constants + // Haptic forces are defined by the direction that generates the force + // e.g. DIRECTION_FROM_LEFT causes wheel to go right. + const int DIRECTION_FROM_LEFT = -1; + const int DIRECTION_FROM_RIGHT = 1; +}; + +#define VK_A 0x41 +#define VK_B 0x42 +#define VK_C 0x43 +#define VK_D 0x44 +#define VK_E 0x45 +#define VK_F 0x46 +#define VK_G 0x47 +#define VK_H 0x48 +#define VK_I 0x49 +#define VK_J 0x4A +#define VK_K 0x4B +#define VK_L 0x4C +#define VK_M 0x4D +#define VK_N 0x4E +#define VK_O 0x4F +#define VK_P 0x50 +#define VK_Q 0x51 +#define VK_R 0x52 +#define VK_S 0x53 +#define VK_T 0x54 +#define VK_U 0x55 +#define VK_V 0x56 +#define VK_W 0x57 +#define VK_X 0x58 +#define VK_Y 0x59 +#define VK_Z 0x5A + +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) + +class Helpers { +public: + int enableLogging = 0; + // helper functions + bool fileExists(char *filename); + // logging + void log(char *msg); + void logInt(int value); + void logInit(char *msg); + // reading memory + LPVOID GetTranslatedOffset(INT_PTR offset); + int ReadInt32(INT_PTR offset, bool isRelativeOffset); + UINT8 ReadByte(INT_PTR offset, bool isRelativeOffset); + float WriteFloat32(INT_PTR offset, float val, bool isRelativeOffset); + UINT8 WriteByte(INT_PTR offset, UINT8 val, bool isRelativeOffset); + INT_PTR WriteIntPtr(INT_PTR offset, INT_PTR val, bool isRelativeOffset); + UINT8 WriteNop(INT_PTR offset, bool isRelativeOffset); + INT_PTR ReadIntPtr(INT_PTR offset, bool isRelativeOffset); + float ReadFloat32(INT_PTR offset, bool isRelativeOffset); +}; + +class Game { +public: + virtual void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file 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/Config/FFBPlugin.ini b/Config/FFBPlugin.ini new file mode 100644 index 0000000..b2c966a --- /dev/null +++ b/Config/FFBPlugin.ini @@ -0,0 +1,442 @@ +; *********************************************************************************************************************************** +; **************************************************** FFBPlugin.ini source file **************************************************** +; *********************************************************************************************************************************** + +; This file contains a master list of settings -- both default values and overrides for specific games. +; This file should not necessarily be distributed upon release. Rather, a post-build step creates individual files for various games +; that take into account the default settings and each games overrides. + +; *********************************************************************************************************************************** +; ************************************************* Default values set for all games ************************************************ +; *********************************************************************************************************************************** + +[Settings] +; GameId specifies the game behavior to use - e.g. which address to read, how to interpret values, etc. +GameId=-1 +; All forces /designated within a game/ will be scaled to exist between MinForce and MaxForce +; 0-100: you may want to set a min force if your wheel doesn't deliver sufficient forces when values are low +MinForce=0 +; 0-100: you may want to set a max force below 100 if your wheel's forces are stronger than desired @ 100% +MaxForce=100 +; Set Device GUID to connect to specific joystick or controller. +DeviceGUID= +;Set to 1 if you want to enable rumble, else 0. +EnableRumble=1 +; Set to 1 to generate log.txt, else 0. Logs will be appended and not cleared. +ReverseRumble=0 +Logging=1 +; When a command is set that contradicts a prior command, clear the prior command. Probably should stay as 1. +ResetFeedback=1 +; Length of a feedback command. While a long period works fine (as long as ResetFeedback=1), some games may still require shorter ones. +FeedbackLength=5000 +; If a game does not specify its own Centering or Friction forces (e.g. only specifies roll left/right), +; then a default centering and friction force can be applied here. If a game has any of its own such forces, +; these values will be overwritten immediately in-game. +; 0-100; Centering is the force that brings the wheel back to the center. Use -1 to disable behavior. +DefaultCentering=0 +; 0-100; Friction determines how difficult a wheel is to turn. Use -1 to disable behavior. +DefaultFriction=0 +; Beep when plugin hooks the exe +BeepWhenHook=0 +; Alternative FFB is for PWM2M2 board and wheel etc +AlternativeFFB=0 +AlternativeMinForceLeft=0 +AlternativeMaxForceLeft=-100 +AlternativeMinForceRight=0 +AlternativeMaxForceRight=100 +ForceShowDeviceGUIDMessageBox=0 + +; *********************************************************************************************************************************** +; ************************************************ Game overrides are specified below *********************************************** +; *********************************************************************************************************************************** + +[Daytona Championship USA] +GameId=1 +MinForce=10 +MaxForce=75 +FeedbackLength=30000 +ShowButtonNumbersForSetup=0 +ChangeGearsViaPlugin=0 +EscapeKeyExitViaPlugin=0 +MenuMovementViaPlugin=0 +Gear1=8 +Gear2=10 +Gear3=9 +Gear4=11 +GearUp=4 +GearDown=5 +HideCursor=0 +;Gear buttons pre-set for Logitech G25 Shifter + +[Demul] +GameId=26 +FeedbackLength=500 +FFBMode=0 + +[Wacky Races] +GameId=2 +MinForce=5 +MaxForce=75 +DefaultCentering=15 + +[Chase HQ 2] +GameId=3 +MinForce=5 +MaxForce=75 +DefaultCentering=15 + +[AfterburnerClimax] +GameId=15 +Rumble1Strength=50 +Rumble2Strength=100 +Rumble1Length=200 +Rumble2Length=200 + +[LGI] +GameId=31 +Device2GUID= +Knock1pStrength=50 +Motor1pStrength=60 +Health1pStrength=100 +Knock2pStrength=50 +Motor2pStrength=60 +Health2pStrength=100 +HowtoRumbleKnockEffect=0 +HowtoRumbleMotorEffect=0 +HowtoRumbleHealthEffect=0 + +[LGI3D] +GameId=30 +Device2GUID= +Knock1pStrength=50 +Motor1pStrength=60 +Health1pStrength=100 +Knock2pStrength=50 +Motor2pStrength=60 +Health2pStrength=100 +HowtoRumbleKnockEffect=0 +HowtoRumbleMotorEffect=0 +HowtoRumbleHealthEffect=0 + +[Sega Racing Classic] +GameId=5 +FeedbackLength=500 +FFBMode=0 + +[Sega Rally 3] +GameId=6 +FeedbackLength=30000 +DefaultCentering=15 + +[InitialD4] +GameId=16 +FeedbackLength=500 +FFBMode=0 + +[InitialD4Japan] +GameId=24 +FeedbackLength=500 +FFBMode=0 + +[InitialD5] +GameId=23 +FeedbackLength=500 +FFBMode=0 + +[InitialD6] +GameId=8 +DefaultCentering=30 +FeedbackLength=500 +SineDivision=150 + +[InitialD7] +GameId=17 +DefaultCentering=30 +FeedbackLength=500 +SineDivision=150 + +[InitialD8] +GameId=18 +DefaultCentering=30 +FeedbackLength=500 +SineDivision=150 + +[Ford Racing] +GameId=7 +MaxForce=85 +DefaultCentering=20 + +[Machstorm] +GameId=14 +Power1RumbleStrength=10 +Power2RumbleStrength=20 +Power3RumbleStrength=30 +Power4RumbleStrength=40 +Power5RumbleStrength=50 +Power6RumbleStrength=60 +Power7RumbleStrength=70 +Power8RumbleStrength=80 +Power9RumbleStrength=90 +Power10RumbleStrength=100 +Power1RumbleLength=50 +Power2RumbleLength=50 +Power3RumbleLength=50 +Power4RumbleLength=50 +Power5RumbleLength=50 +Power6RumbleLength=50 +Power7RumbleLength=50 +Power8RumbleLength=50 +Power9RumbleLength=50 +Power10RumbleLength=100 + +[PokkenTournament] +GameId=19 +RumbleStrength=100 +RumbleLength=500 +HowtoRumble=0 + +[Mario Kart Arcade GP DX v100] +GameId=11 +DefaultCentering=25 +FeedbackLength=500 + +[Battle Gear 4] +GameId=13 +DefaultCentering=25 +FeedbackLength=500 + +[Outrun 2 Special Tours Deluxe Custom] +GameId=12 +MinForce=0 +MaxForce=100 +FeedbackLength=500 +DefaultCentering=-1 +FFBMode=0 + +[Outrun 2 Special Tours Deluxe Real] +GameId=35 +MinForce=0 +MaxForce=100 +FeedbackLength=500 + +[WMMT5] +GameId=9 +DefaultCentering=0 +FeedbackLength=80 +Logging=0 + +[Mame 0199 32bit] +GameId=4 +MinForce=0 +MaxForce=75 +DefaultCentering=0 +FeedbackLength=500 +FFBMode=0 + +[Mame 0199 64bit] +GameId=34 +MinForce=0 +MaxForce=75 +DefaultCentering=0 +FeedbackLength=500 +FFBMode=0 + +[Mame 0206 32bit] +GameId=32 +MinForce=0 +MaxForce=75 +DefaultCentering=0 +FeedbackLength=500 +FFBMode=0 + +[Mame 0206 64bit] +GameId=33 +MinForce=0 +MaxForce=75 +DefaultCentering=0 +FeedbackLength=500 +FFBMode=0 + +[Sonic & Sega All Stars Racing] +GameId=21 +FeedbackLength=500 + +[GTI Club Supermini Festa] +GameId=27 +FeedbackLength=500 +FFBMode=0 + +[Road Fighters 3D] +GameId=29 +FeedbackLength=500 +FFBMode=0 +InputDeviceWheelEnable=0 +InputDeviceWheelSteeringAxis=0 +InputDeviceWheelAcclAxis=1 +InputDeviceWheelBrakeAxis=2 +InputDeviceWheelReverseAxis=0 +InputDeviceCombinedPedals=0 +SteeringDeadzone=2 +PedalDeadzone=2 +SequentialGears=0 +ShowButtonNumbersForSetup=0 +ShowAxisForSetup=0 +DpadUp= +DpadDown= +DpadLeft= +DpadRight= +ExitButton=2 +TestButton=7 +ServiceButton=6 +CreditButton=0 +ViewButton=3 +ThreeDimensionalButton=1 +leverUp=4 +leverDown=5 +leverLeft=8 +leverRight=9 +Device2GUID= +DpadUpDevice2= +DpadDownDevice2= +DpadLeftDevice2= +DpadRightDevice2= +ExitButtonDevice2=2 +TestButtonDevice2=7 +ServiceButtonDevice2=6 +CreditButtonDevice2=0 +ViewButtonDevice2=3 +ThreeDimensionalButtonDevice2=1 +leverUpDevice2=4 +leverDownDevice2=5 +leverLeftDevice2=8 +leverRightDevice2=9 + +[Button Rumble 32bit] +GameId=28 +ShowButtonNumbersForSetup=0 +BothRumbleMotor=1 +LeftRumbleMotor=0 +RightRumbleMotor=0 +RumbleStrength=100 +RumbleLength=0 +Device2GUID= +Button1Rumble=0 +Button2Rumble=1 +Button3Rumble=2 +Button4Rumble=3 +Button5Rumble=4 +Button6Rumble=5 +Button7Rumble=6 +Button8Rumble=7 +Button9Rumble=8 +Button10Rumble=9 +Button1Device2Rumble=0 +Button2Device2Rumble=1 +Button3Device2Rumble=2 +Button4Device2Rumble=3 +Button5Device2Rumble=4 +Button6Device2Rumble=5 +Button7Device2Rumble=6 +Button8Device2Rumble=7 +Button9Device2Rumble=8 +Button10Device2Rumble=9 + +[Button Rumble 64bit] +GameId=36 +ShowButtonNumbersForSetup=0 +BothRumbleMotor=1 +LeftRumbleMotor=0 +RightRumbleMotor=0 +RumbleStrength=100 +RumbleLength=0 +Device2GUID= +Button1Rumble=0 +Button2Rumble=1 +Button3Rumble=2 +Button4Rumble=3 +Button5Rumble=4 +Button6Rumble=5 +Button7Rumble=6 +Button8Rumble=7 +Button9Rumble=8 +Button10Rumble=9 +Button1Device2Rumble=0 +Button2Device2Rumble=1 +Button3Device2Rumble=2 +Button4Device2Rumble=3 +Button5Device2Rumble=4 +Button6Device2Rumble=5 +Button7Device2Rumble=6 +Button8Device2Rumble=7 +Button9Device2Rumble=8 +Button10Device2Rumble=9 + +[Mario Kart Arcade GP DX v110] +GameId=20 +DefaultCentering=-1 +FeedbackLength=500 +ConstantEffectForSteering=1 +ConstantEffectForSteeringStrength=128 +WeaponRumble=1 +WeaponRumbleStrength=30 +CoinRumble=1 +CoinRumbleStrength=20 +DriftRumble=1 +DriftRumbleControllerStrengthMultiplier=100 +HitGroundRumble=1 +HitGroundRumbleStrength=15 +BoostRumble=1 +BoostRumbleStrength=50 +MainShakeRumble=1 +MainShakeRumbleStrength=100 +DirtRumble=1 +DirtRumbleStrength=30 +GrassRumble=1 +GrassRumbleStrength=20 +SandRumble=1 +SandRumbleStrength=10 +WaterRumble=1 +WaterRumbleWheelStrength=65 +WaterRumbleControllerStrengthMultiplier=100 +TileRumble=1 +TileRumbleStrength=20 +CarpetRumble=1 +CarpetRumbleStrength=20 +SpeedBumpRumble=1 +SpeedBumpRumbleStrength=20 +RoughTrackRumble=1 +RoughTrackRumbleStrength=10 +BridgeRumble=1 +BridgeRumbleStrength=40 +HideCursor=0 + +[M2Emulator] +GameId=25 +MinForce=0 +MaxForce=100 +FeedbackLength=500 +FFBMode=0 +DaytonaAIMultiplayerHack=0 +DaytonaForcePanoramicAttract=0 + +; *********************************************************************************************************************************** +; ************************************************* Test cases are established below ************************************************ +; *********************************************************************************************************************************** +; +;[_Test_Const] +;GameId=-1 +; +;[_Test_Sine] +;GameId=-2 +; +;[_Test_Friction] +;GameId=-3 +; +;[_Test_Spring] +;GameId=-4 +; +;[_Test_Heavy] +;GameId=-5 +; +;[_Test_Loose] +;GameId=-6 \ No newline at end of file diff --git a/DLLWrapper.asm b/DLLWrapper.asm new file mode 100644 index 0000000..747f950 --- /dev/null +++ b/DLLWrapper.asm @@ -0,0 +1,668 @@ +IFDEF RAX +ELSE + .MODEL flat, C +ENDIF + +WrapFunction MACRO functionName + +IFDEF RAX + EXTERN @CatStr( original, functionName): QWORD +ELSE + EXTERN @CatStr( original, functionName): DWORD +ENDIF + +@CatStr( _, functionName ) PROC +jmp [ @CatStr( original, functionName) ] +@CatStr( _, functionName ) ENDP + +ENDM + +_DATA SEGMENT +_DATA ENDS +_TEXT SEGMENT + +WrapFunction CreateDirect3D11DeviceFromDXGIDevice +WrapFunction CreateDirect3D11SurfaceFromDXGISurface +WrapFunction D3D11CoreCreateDevice +WrapFunction D3D11CoreCreateLayeredDevice +WrapFunction D3D11CoreGetLayeredDeviceSize +WrapFunction D3D11CoreRegisterLayers +WrapFunction D3D11CreateDevice +WrapFunction D3D11CreateDeviceAndSwapChain +WrapFunction D3D11CreateDeviceForD3D12 +WrapFunction D3D11On12CreateDevice +WrapFunction D3DKMTCloseAdapter +WrapFunction D3DKMTCreateAllocation +WrapFunction D3DKMTCreateContext +WrapFunction D3DKMTCreateDevice +WrapFunction D3DKMTCreateSynchronizationObject +WrapFunction D3DKMTDestroyAllocation +WrapFunction D3DKMTDestroyContext +WrapFunction D3DKMTDestroyDevice +WrapFunction D3DKMTDestroySynchronizationObject +WrapFunction D3DKMTEscape +WrapFunction D3DKMTGetContextSchedulingPriority +WrapFunction D3DKMTGetDeviceState +WrapFunction D3DKMTGetDisplayModeList +WrapFunction D3DKMTGetMultisampleMethodList +WrapFunction D3DKMTGetRuntimeData +WrapFunction D3DKMTGetSharedPrimaryHandle +WrapFunction D3DKMTLock +WrapFunction D3DKMTOpenAdapterFromHdc +WrapFunction D3DKMTOpenResource +WrapFunction D3DKMTPresent +WrapFunction D3DKMTQueryAdapterInfo +WrapFunction D3DKMTQueryAllocationResidency +WrapFunction D3DKMTQueryResourceInfo +WrapFunction D3DKMTRender +WrapFunction D3DKMTSetAllocationPriority +WrapFunction D3DKMTSetContextSchedulingPriority +WrapFunction D3DKMTSetDisplayMode +WrapFunction D3DKMTSetDisplayPrivateDriverFormat +WrapFunction D3DKMTSetGammaRamp +WrapFunction D3DKMTSetVidPnSourceOwner +WrapFunction D3DKMTSignalSynchronizationObject +WrapFunction D3DKMTUnlock +WrapFunction D3DKMTWaitForSynchronizationObject +WrapFunction D3DKMTWaitForVerticalBlankEvent +WrapFunction D3DPerformance_BeginEvent +WrapFunction D3DPerformance_EndEvent +WrapFunction D3DPerformance_GetStatus +WrapFunction D3DPerformance_SetMarker +WrapFunction EnableFeatureLevelUpgrade +WrapFunction OpenAdapter10 +WrapFunction OpenAdapter10_2 + +WrapFunction XInputGetState +WrapFunction XInputSetState +WrapFunction XInputGetCapabilities +WrapFunction XInputEnable +WrapFunction XInputGetDSoundAudioDeviceGuids +WrapFunction XInputGetBatteryInformation +WrapFunction XInputGetKeystroke +WrapFunction XInputGetStateEx +WrapFunction XInputWaitForGuideButton +WrapFunction XInputCancelGuideButtonWait +WrapFunction XInputPowerOffController + +WrapFunction Direct3DShaderValidatorCreate9 +WrapFunction PSGPError +WrapFunction PSGPSampleTexture +WrapFunction D3DPERF_BeginEvent +WrapFunction D3DPERF_EndEvent +WrapFunction D3DPERF_GetStatus +WrapFunction D3DPERF_QueryRepeatFrame +WrapFunction D3DPERF_SetMarker +WrapFunction D3DPERF_SetOptions +WrapFunction D3DPERF_SetRegion +WrapFunction DebugSetLevel +WrapFunction DebugSetMute +WrapFunction Direct3D9EnableMaximizedWindowedModeShim +WrapFunction Direct3DCreate9 +WrapFunction Direct3DCreate9Ex + +WrapFunction wglUseFontOutlinesA +WrapFunction wglUseFontOutlinesW +WrapFunction wglDescribeLayerPlane +WrapFunction wglSetLayerPaletteEntries +WrapFunction wglGetLayerPaletteEntries +WrapFunction wglRealizeLayerPalette +WrapFunction wglSwapLayerBuffers +WrapFunction wglMakeCurrent +WrapFunction GlmfInitPlayback +WrapFunction GlmfBeginGlsBlock +WrapFunction GlmfPlayGlsRecord +WrapFunction GlmfEndGlsBlock +WrapFunction GlmfEndPlayback +WrapFunction GlmfCloseMetaFile +WrapFunction wglSwapMultipleBuffers +WrapFunction wglCreateLayerContext +WrapFunction wglCreateContext +WrapFunction wglDeleteContext +WrapFunction wglGetCurrentContext +WrapFunction wglGetCurrentDC +WrapFunction wglUseFontBitmapsA +WrapFunction wglUseFontBitmapsW +WrapFunction wglShareLists +WrapFunction wglGetDefaultProcAddress +WrapFunction wglGetProcAddress +WrapFunction wglCopyContext +WrapFunction glDebugEntry +WrapFunction wglGetPixelFormat +WrapFunction wglSetPixelFormat +WrapFunction wglChoosePixelFormat +WrapFunction wglDescribePixelFormat +WrapFunction wglSwapBuffers +WrapFunction glCallList +WrapFunction glCallLists +WrapFunction glBegin +WrapFunction glColor3b +WrapFunction glColor3bv +WrapFunction glColor3d +WrapFunction glColor3dv +WrapFunction glColor3f +WrapFunction glColor3fv +WrapFunction glColor3i +WrapFunction glColor3iv +WrapFunction glColor3s +WrapFunction glColor3sv +WrapFunction glColor3ub +WrapFunction glColor3ubv +WrapFunction glColor3ui +WrapFunction glColor3uiv +WrapFunction glColor3us +WrapFunction glColor3usv +WrapFunction glColor4b +WrapFunction glColor4bv +WrapFunction glColor4d +WrapFunction glColor4dv +WrapFunction glColor4f +WrapFunction glColor4fv +WrapFunction glColor4i +WrapFunction glColor4iv +WrapFunction glColor4s +WrapFunction glColor4sv +WrapFunction glColor4ub +WrapFunction glColor4ubv +WrapFunction glColor4ui +WrapFunction glColor4uiv +WrapFunction glColor4us +WrapFunction glColor4usv +WrapFunction glEdgeFlag +WrapFunction glEdgeFlagv +WrapFunction glEnd +WrapFunction glIndexd +WrapFunction glIndexdv +WrapFunction glIndexf +WrapFunction glIndexfv +WrapFunction glIndexi +WrapFunction glIndexiv +WrapFunction glIndexs +WrapFunction glIndexsv +WrapFunction glNormal3b +WrapFunction glNormal3bv +WrapFunction glNormal3d +WrapFunction glNormal3dv +WrapFunction glNormal3f +WrapFunction glNormal3fv +WrapFunction glNormal3i +WrapFunction glNormal3iv +WrapFunction glNormal3s +WrapFunction glNormal3sv +WrapFunction glTexCoord1d +WrapFunction glTexCoord1dv +WrapFunction glTexCoord1f +WrapFunction glTexCoord1fv +WrapFunction glTexCoord1i +WrapFunction glTexCoord1iv +WrapFunction glTexCoord1s +WrapFunction glTexCoord1sv +WrapFunction glTexCoord2d +WrapFunction glTexCoord2dv +WrapFunction glTexCoord2f +WrapFunction glTexCoord2fv +WrapFunction glTexCoord2i +WrapFunction glTexCoord2iv +WrapFunction glTexCoord2s +WrapFunction glTexCoord2sv +WrapFunction glTexCoord3d +WrapFunction glTexCoord3dv +WrapFunction glTexCoord3f +WrapFunction glTexCoord3fv +WrapFunction glTexCoord3i +WrapFunction glTexCoord3iv +WrapFunction glTexCoord3s +WrapFunction glTexCoord3sv +WrapFunction glTexCoord4d +WrapFunction glTexCoord4dv +WrapFunction glTexCoord4f +WrapFunction glTexCoord4fv +WrapFunction glTexCoord4i +WrapFunction glTexCoord4iv +WrapFunction glTexCoord4s +WrapFunction glTexCoord4sv +WrapFunction glVertex2d +WrapFunction glVertex2dv +WrapFunction glVertex2f +WrapFunction glVertex2fv +WrapFunction glVertex2i +WrapFunction glVertex2iv +WrapFunction glVertex2s +WrapFunction glVertex2sv +WrapFunction glVertex3d +WrapFunction glVertex3dv +WrapFunction glVertex3f +WrapFunction glVertex3fv +WrapFunction glVertex3i +WrapFunction glVertex3iv +WrapFunction glVertex3s +WrapFunction glVertex3sv +WrapFunction glVertex4d +WrapFunction glVertex4dv +WrapFunction glVertex4f +WrapFunction glVertex4fv +WrapFunction glVertex4i +WrapFunction glVertex4iv +WrapFunction glVertex4s +WrapFunction glVertex4sv +WrapFunction glMaterialf +WrapFunction glMaterialfv +WrapFunction glMateriali +WrapFunction glMaterialiv +WrapFunction glDisable +WrapFunction glEnable +WrapFunction glPopAttrib +WrapFunction glPushAttrib +WrapFunction glEvalCoord1d +WrapFunction glEvalCoord1dv +WrapFunction glEvalCoord1f +WrapFunction glEvalCoord1fv +WrapFunction glEvalCoord2d +WrapFunction glEvalCoord2dv +WrapFunction glEvalCoord2f +WrapFunction glEvalCoord2fv +WrapFunction glEvalPoint1 +WrapFunction glEvalPoint2 +WrapFunction glLoadIdentity +WrapFunction glLoadMatrixf +WrapFunction glLoadMatrixd +WrapFunction glMatrixMode +WrapFunction glMultMatrixf +WrapFunction glMultMatrixd +WrapFunction glPopMatrix +WrapFunction glPushMatrix +WrapFunction glRotated +WrapFunction glRotatef +WrapFunction glScaled +WrapFunction glScalef +WrapFunction glTranslated +WrapFunction glTranslatef +WrapFunction glArrayElement +WrapFunction glBindTexture +WrapFunction glColorPointer +WrapFunction glDisableClientState +WrapFunction glDrawArrays +WrapFunction glDrawElements +WrapFunction glEdgeFlagPointer +WrapFunction glEnableClientState +WrapFunction glIndexPointer +WrapFunction glIndexub +WrapFunction glIndexubv +WrapFunction glInterleavedArrays +WrapFunction glNormalPointer +WrapFunction glPolygonOffset +WrapFunction glTexCoordPointer +WrapFunction glVertexPointer +WrapFunction glGetPointerv +WrapFunction glPopClientAttrib +WrapFunction glPushClientAttrib +WrapFunction glClear +WrapFunction glClearAccum +WrapFunction glClearIndex +WrapFunction glClearColor +WrapFunction glClearStencil +WrapFunction glClearDepth +WrapFunction glBitmap +WrapFunction glTexImage1D +WrapFunction glTexImage2D +WrapFunction glCopyPixels +WrapFunction glReadPixels +WrapFunction glDrawPixels +WrapFunction glRectd +WrapFunction glRectdv +WrapFunction glRectf +WrapFunction glRectfv +WrapFunction glRecti +WrapFunction glRectiv +WrapFunction glRects +WrapFunction glRectsv +WrapFunction glEndList +WrapFunction glDeleteLists +WrapFunction glGenLists +WrapFunction glListBase +WrapFunction glRasterPos2d +WrapFunction glRasterPos2dv +WrapFunction glRasterPos2f +WrapFunction glRasterPos2fv +WrapFunction glRasterPos2i +WrapFunction glRasterPos2iv +WrapFunction glRasterPos2s +WrapFunction glRasterPos2sv +WrapFunction glRasterPos3d +WrapFunction glRasterPos3dv +WrapFunction glRasterPos3f +WrapFunction glRasterPos3fv +WrapFunction glRasterPos3i +WrapFunction glRasterPos3iv +WrapFunction glRasterPos3s +WrapFunction glRasterPos3sv +WrapFunction glRasterPos4d +WrapFunction glRasterPos4dv +WrapFunction glRasterPos4f +WrapFunction glRasterPos4fv +WrapFunction glRasterPos4i +WrapFunction glRasterPos4iv +WrapFunction glRasterPos4s +WrapFunction glRasterPos4sv +WrapFunction glClipPlane +WrapFunction glColorMaterial +WrapFunction glCullFace +WrapFunction glFogf +WrapFunction glFogfv +WrapFunction glFogi +WrapFunction glFogiv +WrapFunction glFrontFace +WrapFunction glHint +WrapFunction glLightf +WrapFunction glLightfv +WrapFunction glLighti +WrapFunction glLightiv +WrapFunction glLightModelf +WrapFunction glLightModelfv +WrapFunction glLightModeli +WrapFunction glLightModeliv +WrapFunction glLineStipple +WrapFunction glLineWidth +WrapFunction glPointSize +WrapFunction glPolygonMode +WrapFunction glPolygonStipple +WrapFunction glFinish +WrapFunction glShadeModel +WrapFunction glTexParameterf +WrapFunction glTexParameterfv +WrapFunction glTexParameteri +WrapFunction glTexParameteriv +WrapFunction glTexEnvf +WrapFunction glTexEnvfv +WrapFunction glTexEnvi +WrapFunction glTexEnviv +WrapFunction glTexGend +WrapFunction glTexGendv +WrapFunction glTexGenf +WrapFunction glTexGenfv +WrapFunction glTexGeni +WrapFunction glTexGeniv +WrapFunction glFeedbackBuffer +WrapFunction glSelectBuffer +WrapFunction glRenderMode +WrapFunction glInitNames +WrapFunction glLoadName +WrapFunction glPassThrough +WrapFunction glPopName +WrapFunction glPushName +WrapFunction glDrawBuffer +WrapFunction glStencilMask +WrapFunction glColorMask +WrapFunction glDepthMask +WrapFunction glIndexMask +WrapFunction glScissor +WrapFunction glNewList +WrapFunction glAccum +WrapFunction glFlush +WrapFunction glMap1d +WrapFunction glMap1f +WrapFunction glMap2d +WrapFunction glMap2f +WrapFunction glMapGrid1d +WrapFunction glMapGrid1f +WrapFunction glMapGrid2d +WrapFunction glMapGrid2f +WrapFunction glEvalMesh1 +WrapFunction glEvalMesh2 +WrapFunction glAlphaFunc +WrapFunction glBlendFunc +WrapFunction glLogicOp +WrapFunction glStencilFunc +WrapFunction glStencilOp +WrapFunction glDepthFunc +WrapFunction glPixelZoom +WrapFunction glPixelTransferf +WrapFunction glPixelTransferi +WrapFunction glPixelStoref +WrapFunction glPixelStorei +WrapFunction glPixelMapfv +WrapFunction glPixelMapuiv +WrapFunction glPixelMapusv +WrapFunction glReadBuffer +WrapFunction glGetBooleanv +WrapFunction glGetClipPlane +WrapFunction glGetDoublev +WrapFunction glGetError +WrapFunction glGetFloatv +WrapFunction glGetIntegerv +WrapFunction glGetLightfv +WrapFunction glGetLightiv +WrapFunction glGetMapdv +WrapFunction glGetMapfv +WrapFunction glGetMapiv +WrapFunction glGetMaterialfv +WrapFunction glGetMaterialiv +WrapFunction glGetPixelMapfv +WrapFunction glGetPixelMapuiv +WrapFunction glGetPixelMapusv +WrapFunction glGetPolygonStipple +WrapFunction glGetString +WrapFunction glGetTexEnvfv +WrapFunction glGetTexEnviv +WrapFunction glGetTexGendv +WrapFunction glGetTexGenfv +WrapFunction glGetTexGeniv +WrapFunction glGetTexImage +WrapFunction glGetTexParameterfv +WrapFunction glGetTexParameteriv +WrapFunction glGetTexLevelParameterfv +WrapFunction glGetTexLevelParameteriv +WrapFunction glIsEnabled +WrapFunction glIsList +WrapFunction glDepthRange +WrapFunction glFrustum +WrapFunction glOrtho +WrapFunction glViewport +WrapFunction glAreTexturesResident +WrapFunction glCopyTexImage1D +WrapFunction glCopyTexImage2D +WrapFunction glCopyTexSubImage1D +WrapFunction glCopyTexSubImage2D +WrapFunction glDeleteTextures +WrapFunction glGenTextures +WrapFunction glIsTexture +WrapFunction glPrioritizeTextures +WrapFunction glTexSubImage1D +WrapFunction glTexSubImage2D + +WrapFunction PlaySoundW +WrapFunction timeSetEvent +WrapFunction timeKillEvent +WrapFunction midiOutMessage +WrapFunction timeBeginPeriod +WrapFunction timeGetTime +WrapFunction NotifyCallbackData +WrapFunction WOW32DriverCallback +WrapFunction WOW32ResolveMultiMediaHandle +WrapFunction aux32Message +WrapFunction joy32Message +WrapFunction mid32Message +WrapFunction mod32Message +WrapFunction mxd32Message +WrapFunction tid32Message +WrapFunction wid32Message +WrapFunction wod32Message +WrapFunction mci32Message +WrapFunction CloseDriver +WrapFunction DefDriverProc +WrapFunction DriverCallback +WrapFunction DrvGetModuleHandle +WrapFunction GetDriverModuleHandle +WrapFunction OpenDriver +WrapFunction PlaySound +WrapFunction Ordinal2 +WrapFunction SendDriverMessage +WrapFunction auxGetDevCapsA +WrapFunction auxGetDevCapsW +WrapFunction auxGetNumDevs +WrapFunction auxGetVolume +WrapFunction auxOutMessage +WrapFunction auxSetVolume +WrapFunction joyConfigChanged +WrapFunction joyGetDevCapsA +WrapFunction joyGetDevCapsW +WrapFunction joyGetNumDevs +WrapFunction joyGetPosEx +WrapFunction joyGetPos +WrapFunction joyGetThreshold +WrapFunction joyReleaseCapture +WrapFunction joySetCapture +WrapFunction joySetThreshold +WrapFunction midiConnect +WrapFunction midiDisconnect +WrapFunction midiInAddBuffer +WrapFunction midiInClose +WrapFunction midiInGetDevCapsA +WrapFunction midiInGetDevCapsW +WrapFunction midiInGetErrorTextA +WrapFunction midiInGetErrorTextW +WrapFunction midiInGetID +WrapFunction midiInGetNumDevs +WrapFunction midiInMessage +WrapFunction midiInOpen +WrapFunction midiInPrepareHeader +WrapFunction midiInReset +WrapFunction midiInStart +WrapFunction midiInStop +WrapFunction midiInUnprepareHeader +WrapFunction midiOutCacheDrumPatches +WrapFunction midiOutCachePatches +WrapFunction midiOutClose +WrapFunction midiOutGetDevCapsA +WrapFunction midiOutGetDevCapsW +WrapFunction midiOutGetErrorTextA +WrapFunction midiOutGetErrorTextW +WrapFunction midiOutGetID +WrapFunction midiOutGetNumDevs +WrapFunction midiOutGetVolume +WrapFunction midiOutLongMsg +WrapFunction midiOutOpen +WrapFunction midiOutPrepareHeader +WrapFunction midiOutReset +WrapFunction midiOutSetVolume +WrapFunction midiOutShortMsg +WrapFunction midiOutUnprepareHeader +WrapFunction midiStreamClose +WrapFunction midiStreamOpen +WrapFunction midiStreamOut +WrapFunction midiStreamPause +WrapFunction midiStreamPosition +WrapFunction midiStreamProperty +WrapFunction midiStreamRestart +WrapFunction midiStreamStop +WrapFunction mixerClose +WrapFunction mixerGetControlDetailsA +WrapFunction mixerGetControlDetailsW +WrapFunction mixerGetDevCapsA +WrapFunction mixerGetDevCapsW +WrapFunction mixerGetID +WrapFunction mixerGetLineControlsA +WrapFunction mixerGetLineControlsW +WrapFunction mixerGetLineInfoA +WrapFunction mixerGetLineInfoW +WrapFunction mixerGetNumDevs +WrapFunction mixerMessage +WrapFunction mixerOpen +WrapFunction mixerSetControlDetails +WrapFunction mmDrvInstall +WrapFunction mmGetCurrentTask +WrapFunction mmTaskBlock +WrapFunction mmTaskCreate +WrapFunction mmTaskSignal +WrapFunction mmTaskYield +WrapFunction mmioAdvance +WrapFunction mmioAscend +WrapFunction mmioClose +WrapFunction mmioCreateChunk +WrapFunction mmioDescend +WrapFunction mmioFlush +WrapFunction mmioGetInfo +WrapFunction mmioInstallIOProcA +WrapFunction mmioInstallIOProcW +WrapFunction mmioOpenA +WrapFunction mmioOpenW +WrapFunction mmioRead +WrapFunction mmioRenameA +WrapFunction mmioRenameW +WrapFunction mmioSeek +WrapFunction mmioSendMessage +WrapFunction mmioSetBuffer +WrapFunction mmioSetInfo +WrapFunction mmioStringToFOURCCA +WrapFunction mmioStringToFOURCCW +WrapFunction mmioWrite +WrapFunction timeEndPeriod +WrapFunction timeGetDevCaps +WrapFunction timeGetSystemTime +WrapFunction waveInAddBuffer +WrapFunction waveInClose +WrapFunction waveInGetDevCapsA +WrapFunction waveInGetDevCapsW +WrapFunction waveInGetErrorTextA +WrapFunction waveInGetErrorTextW +WrapFunction waveInGetID +WrapFunction waveInGetNumDevs +WrapFunction waveInGetPosition +WrapFunction waveInMessage +WrapFunction waveInOpen +WrapFunction waveInPrepareHeader +WrapFunction waveInReset +WrapFunction waveInStart +WrapFunction waveInStop +WrapFunction waveInUnprepareHeader +WrapFunction waveOutBreakLoop +WrapFunction waveOutClose +WrapFunction waveOutGetDevCapsA +WrapFunction waveOutGetDevCapsW +WrapFunction waveOutGetErrorTextA +WrapFunction waveOutGetErrorTextW +WrapFunction waveOutGetID +WrapFunction waveOutGetNumDevs +WrapFunction waveOutGetPitch +WrapFunction waveOutGetPlaybackRate +WrapFunction waveOutGetPosition +WrapFunction waveOutGetVolume +WrapFunction waveOutMessage +WrapFunction waveOutOpen +WrapFunction waveOutPause +WrapFunction waveOutPrepareHeader +WrapFunction waveOutReset +WrapFunction waveOutRestart +WrapFunction waveOutSetPitch +WrapFunction waveOutSetPlaybackRate +WrapFunction waveOutSetVolume +WrapFunction waveOutUnprepareHeader +WrapFunction waveOutWrite +WrapFunction mciExecute +WrapFunction mciGetErrorStringA +WrapFunction mciGetErrorStringW +WrapFunction mciSendCommandA +WrapFunction mciSendCommandW +WrapFunction mciSendStringA +WrapFunction mciSendStringW +WrapFunction mciFreeCommandResource +WrapFunction mciLoadCommandResource +WrapFunction mciDriverNotify +WrapFunction mciDriverYield +WrapFunction mciGetCreatorTask +WrapFunction mciGetDeviceIDA +WrapFunction mciGetDeviceIDFromElementIDA +WrapFunction mciGetDeviceIDFromElementIDW +WrapFunction mciGetDeviceIDW +WrapFunction mciGetDriverData +WrapFunction mciGetYieldProc +WrapFunction mciSetDriverData +WrapFunction mciSetYieldProc +WrapFunction PlaySoundA +WrapFunction sndPlaySoundA +WrapFunction sndPlaySoundW +WrapFunction WOWAppExit +WrapFunction mmsystemGetVersion + +_TEXT ENDS +END diff --git a/Dinput8Wrapper.sln b/Dinput8Wrapper.sln new file mode 100644 index 0000000..cd4327b --- /dev/null +++ b/Dinput8Wrapper.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DInput8Wrapper", "Dinput8Wrapper.vcxproj", "{023441F6-2554-440F-9FFB-7E185AB7CF41}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Includes", "Includes", "{3E1C2D29-081D-4B1D-9453-5A1F19212119}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Debug|x64.ActiveCfg = Debug|x64 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Debug|x64.Build.0 = Debug|x64 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Debug|x86.ActiveCfg = Release|Win32 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Debug|x86.Build.0 = Release|Win32 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Release|x64.ActiveCfg = Release|x64 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Release|x64.Build.0 = Release|x64 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Release|x86.ActiveCfg = Release|Win32 + {023441F6-2554-440F-9FFB-7E185AB7CF41}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3C21D57D-0941-43AE-883F-929E3C8A82E1} + EndGlobalSection +EndGlobal diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj new file mode 100644 index 0000000..bab976e --- /dev/null +++ b/Dinput8Wrapper.vcxproj @@ -0,0 +1,374 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + Document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {023441F6-2554-440F-9FFB-7E185AB7CF41} + Win32Proj + Dinput8Wrapper + 10.0.17763.0 + DInput8Wrapper + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + false + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + false + Unicode + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration).$(Platform)\ + $(SolutionDir)$(Configuration).$(Platform)\$(ProjectName)\ + dinput8 + false + + + true + $(SolutionDir)$(Configuration).$(Platform)\ + $(SolutionDir)$(Configuration).$(Platform)\$(ProjectName) + dinput8 + false + + + false + $(SolutionDir)$(Configuration).$(Platform)\ + $(SolutionDir)$(Configuration).$(Platform)\$(ProjectName)\ + dinput8 + false + $(SolutionDir)\Xidi-master\Include\Xidi;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(VC_SourcePath) + sdl2_init + CoreBuild + + + false + $(SolutionDir)$(Configuration).$(Platform)\ + $(SolutionDir)$(Configuration).$(Platform)\$(ProjectName)\ + dinput8 + false + $(SolutionDir)\Xidi-master\Include\Xidi;$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + + + + Disabled + _CRT_SECURE_NO_WARNINGS;DIRECTINPUT_VERSION=0x0800;WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + false + true + Level3 + Include/$(SolutionName) + + + + + Windows + Debug + dinput8.def + dinput8.lib;dxguid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;xinput.lib;%(AdditionalDependencies) + + + Resources + + + true + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest.res + + + + + + + Disabled + _CRT_SECURE_NO_WARNINGS;DIRECTINPUT_VERSION=0x0800;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + false + true + Level3 + Include/$(SolutionName) + + + + + Windows + Debug + dinput8.def + dinput8.lib;dxguid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;xinput.lib;%(AdditionalDependencies) + + + Resources + + + true + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest.res + + + + + NotUsing + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS;DIRECTINPUT_VERSION=0x0800;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + true + false + Level3 + Include/$(SolutionName) + + + Windows + true + true + No + dinput8.def + dinput8.lib;dxguid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + $(OutDir)$(TargetName).lib + + + Resources + + + true + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest.res + + + xcopy /y "$(ProjectDir)Includes\*" "$(OutDir)" +if not exist "$(ProjectDir)Post-Build\node_modules" (cd "$(ProjectDir)Post-Build\" && npm install) +node "$(ProjectDir)Post-Build\build.js" "$(ProjectDir)Config\FFBPlugin.ini" "$(OutDir)\" "$(OutDir)\" +$(ProjectDir)Post-Build\copydlls.bat "$(OutDir)" + + + echo HELLO WORLD +cd $(OutDir) &amp;&amp; for /D /r %d in (.\Deploy\*) do @xcopy *.dll %d\ /y + + + + + + + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS;DIRECTINPUT_VERSION=0x0800;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + true + false + false + Level3 + Include/$(SolutionName) + + + + + Windows + true + true + No + dinput8.def + dinput8.lib;dxguid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + Resources + + + true + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest + + + $(IntDir)$(TargetName)$(TargetExt).embed.manifest.res + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters new file mode 100644 index 0000000..2c3129c --- /dev/null +++ b/Dinput8Wrapper.vcxproj.filters @@ -0,0 +1,248 @@ + + + + + {10dc908c-9b3a-4fb8-835f-9be8d32a1424} + Game Files\ + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + + + + + + + + + Game Files + + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + + Game Files + + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + + + Game Files + + + + + Game Files + + + Game Files + + + + + + Game Files + + + Common Header Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Common Header Files + + + Game Files + + + Common Header Files + + + Game Files + + + Game Files + + + Game Files + + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Game Files + + + Common Header Files + + + Common Header Files + + + Game Files + + + Common Header Files + + + Game Files + + + Common Header Files + + + Game Files + + + Common Header Files + + + + + + + + + \ No newline at end of file diff --git a/Dinput8Wrapper.vcxproj.user b/Dinput8Wrapper.vcxproj.user new file mode 100644 index 0000000..0b0f24d --- /dev/null +++ b/Dinput8Wrapper.vcxproj.user @@ -0,0 +1,6 @@ + + + + true + + \ No newline at end of file diff --git a/DllMain.cpp b/DllMain.cpp new file mode 100644 index 0000000..8f963f8 --- /dev/null +++ b/DllMain.cpp @@ -0,0 +1,2399 @@ +#include +#include +#include +#include +#include +#include "SDL.h" +#include +#include +#include +#include +#include +#include +#include "IDirectInputDevice.h" +#include + +// include all game header files here. +#include "Game Files/TestGame.h" +#include "Game Files/ChaseHQ2.h" +#include "Game Files/Daytona3.h" +#include "Game Files/FordRacing.h" +#include "Game Files/FNF.h" +#include "Game Files/InitialD4.h" +#include "Game Files/InitialD4Japan.h" +#include "Game Files/InitialD5.h" +#include "Game Files/InitialD6.h" +#include "Game Files/InitialD7.h" +#include "Game Files/InitialD8.h" +#include "Game Files/MarioKartGPDX.h" +#include "Game Files/OutRun2Fake.h" +#include "Game Files/OutRun2Real.h" +#include "Game Files/SegaRacingClassic.h" +#include "Game Files/SegaRally3.h" +#include "Game Files/Mame019932bit.h" +#include "Game Files/Mame019964bit.h" +#include "Game Files/WackyRaces.h" +#include "Game Files/WMMT5.h" +#include "Game Files/BG4JP.h" +#include "Game Files/Machstorm.h" +#include "Game Files/AfterburnerClimax.h" +#include "Game Files/PokkenTournament.h" +#include "Game Files/MarioKartGPDX1.10.h" +#include "Game Files/SonicSegaAllStarsRacing.h" +#include "Game Files/M2Emulator.h" +#include "Game Files/GTIClub3.h" +#include "Game Files/Demul.h" +#include "Game Files/ButtonRumble32bit.h" +#include "Game Files/ButtonRumble64bit.h" +#include "Game Files/RoadFighters3D.h" +#include "Game Files/LGI3D.h" +#include "Game Files/LGI.h" +#include "Game Files/Mame020632bit.h" +#include "Game Files/Mame020664bit.h" + +// typedefs +typedef unsigned char U8; +typedef unsigned int U32; + +// DINPUT8 FUNCTION DEFINITIONS +typedef HRESULT(WINAPI* pfnDirectInputDirectInput8Create)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter); +typedef HRESULT(WINAPI* pfnDirectInputDllRegisterServer)(void); +typedef HRESULT(WINAPI* pfnDirectInputDllUnregisterServer)(void); +typedef HRESULT(WINAPI* pfnDirectInputDllCanUnloadNow)(void); +typedef HRESULT(WINAPI* pfnDirectInputDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID* ppv); +typedef LPCDIDATAFORMAT(WINAPI* pfnDirectInputGetdfDIJoystick)(); + +// DINPUT FUNCTION DEFINITIONS +typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateA)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter); +typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateW)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW* ppDI, LPUNKNOWN punkOuter); +typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateEx)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +// DINPUT8 REAL FUNCTIONS +pfnDirectInputDirectInput8Create originalDirectInputDirectInput8Create = NULL; +pfnDirectInputDllRegisterServer originalDirectInputDllRegisterServer = NULL; +pfnDirectInputDllUnregisterServer originalDirectInputDllUnregisterServer = NULL; +pfnDirectInputDllCanUnloadNow originalDirectInputDllCanUnloadNow = NULL; +pfnDirectInputDllGetClassObject originalDirectInputDllGetClassObject = NULL; +pfnDirectInputGetdfDIJoystick originalGetdfDIJoystick = NULL; + +// DINPUT REAL FUNCTIONS +pfnDirectInputDirectInputCreateA originalDirectInputDirectInputCreateA = NULL; +pfnDirectInputDirectInputCreateW originalDirectInputDirectInputCreateW = NULL; +pfnDirectInputDirectInputCreateEx originalDirectInputDirectInputCreateEx = NULL; + +// DX11 REAL FUNCTIONS +extern "C" +{ + FARPROC originalCreateDirect3D11DeviceFromDXGIDevice; + FARPROC originalCreateDirect3D11SurfaceFromDXGISurface; + FARPROC originalD3D11CoreCreateDevice; + FARPROC originalD3D11CoreCreateLayeredDevice; + FARPROC originalD3D11CoreGetLayeredDeviceSize; + FARPROC originalD3D11CoreRegisterLayers; + FARPROC originalD3D11CreateDevice; + FARPROC originalD3D11CreateDeviceAndSwapChain; + FARPROC originalD3D11CreateDeviceForD3D12; + FARPROC originalD3D11On12CreateDevice; + FARPROC originalD3DKMTCloseAdapter; + FARPROC originalD3DKMTCreateAllocation; + FARPROC originalD3DKMTCreateContext; + FARPROC originalD3DKMTCreateDevice; + FARPROC originalD3DKMTCreateSynchronizationObject; + FARPROC originalD3DKMTDestroyAllocation; + FARPROC originalD3DKMTDestroyContext; + FARPROC originalD3DKMTDestroyDevice; + FARPROC originalD3DKMTDestroySynchronizationObject; + FARPROC originalD3DKMTEscape; + FARPROC originalD3DKMTGetContextSchedulingPriority; + FARPROC originalD3DKMTGetDeviceState; + FARPROC originalD3DKMTGetDisplayModeList; + FARPROC originalD3DKMTGetMultisampleMethodList; + FARPROC originalD3DKMTGetRuntimeData; + FARPROC originalD3DKMTGetSharedPrimaryHandle; + FARPROC originalD3DKMTLock; + FARPROC originalD3DKMTOpenAdapterFromHdc; + FARPROC originalD3DKMTOpenResource; + FARPROC originalD3DKMTPresent; + FARPROC originalD3DKMTQueryAdapterInfo; + FARPROC originalD3DKMTQueryAllocationResidency; + FARPROC originalD3DKMTQueryResourceInfo; + FARPROC originalD3DKMTRender; + FARPROC originalD3DKMTSetAllocationPriority; + FARPROC originalD3DKMTSetContextSchedulingPriority; + FARPROC originalD3DKMTSetDisplayMode; + FARPROC originalD3DKMTSetDisplayPrivateDriverFormat; + FARPROC originalD3DKMTSetGammaRamp; + FARPROC originalD3DKMTSetVidPnSourceOwner; + FARPROC originalD3DKMTSignalSynchronizationObject; + FARPROC originalD3DKMTUnlock; + FARPROC originalD3DKMTWaitForSynchronizationObject; + FARPROC originalD3DKMTWaitForVerticalBlankEvent; + FARPROC originalD3DPerformance_BeginEvent; + FARPROC originalD3DPerformance_EndEvent; + FARPROC originalD3DPerformance_GetStatus; + FARPROC originalD3DPerformance_SetMarker; + FARPROC originalEnableFeatureLevelUpgrade; + FARPROC originalOpenAdapter10; + FARPROC originalOpenAdapter10_2; +} + +// XINPUT1_3 REAL FUNCTIONS +extern "C" +{ + FARPROC originalXInputGetState; + FARPROC originalXInputSetState; + FARPROC originalXInputGetCapabilities; + FARPROC originalXInputEnable; + FARPROC originalXInputGetDSoundAudioDeviceGuids; + FARPROC originalXInputGetBatteryInformation; + FARPROC originalXInputGetKeystroke; + FARPROC originalXInputGetStateEx; + FARPROC originalXInputWaitForGuideButton; + FARPROC originalXInputCancelGuideButtonWait; + FARPROC originalXInputPowerOffController; +} + +// D3D9 REAL FUNCTIONS +extern "C" +{ + FARPROC originalDirect3DShaderValidatorCreate9; + FARPROC originalPSGPError; + FARPROC originalPSGPSampleTexture; + FARPROC originalD3DPERF_BeginEvent; + FARPROC originalD3DPERF_EndEvent; + FARPROC originalD3DPERF_GetStatus; + FARPROC originalD3DPERF_QueryRepeatFrame; + FARPROC originalD3DPERF_SetMarker; + FARPROC originalD3DPERF_SetOptions; + FARPROC originalD3DPERF_SetRegion; + FARPROC originalDebugSetLevel; + FARPROC originalDebugSetMute; + FARPROC originalDirect3D9EnableMaximizedWindowedModeShim; + FARPROC originalDirect3DCreate9; + FARPROC originalDirect3DCreate9Ex; +} + +// WINMM REAL FUNCTIONS +extern "C" +{ + FARPROC originalPlaySoundW; + FARPROC originaltimeSetEvent; + FARPROC originaltimeKillEvent; + FARPROC originalmidiOutMessage; + FARPROC originaltimeBeginPeriod; + FARPROC originaltimeGetTime; + FARPROC originalNotifyCallbackData; + FARPROC originalWOW32DriverCallback; + FARPROC originalWOW32ResolveMultiMediaHandle; + FARPROC originalaux32Message; + FARPROC originaljoy32Message; + FARPROC originalmid32Message; + FARPROC originalmod32Message; + FARPROC originalmxd32Message; + FARPROC originaltid32Message; + FARPROC originalwid32Message; + FARPROC originalwod32Message; + FARPROC originalmci32Message; + FARPROC originalCloseDriver; + FARPROC originalDefDriverProc; + FARPROC originalDriverCallback; + FARPROC originalDrvGetModuleHandle; + FARPROC originalGetDriverModuleHandle; + FARPROC originalOpenDriver; + FARPROC originalPlaySound; + FARPROC originalOrdinal2; + FARPROC originalSendDriverMessage; + FARPROC originalauxGetDevCapsA; + FARPROC originalauxGetDevCapsW; + FARPROC originalauxGetNumDevs; + FARPROC originalauxGetVolume; + FARPROC originalauxOutMessage; + FARPROC originalauxSetVolume; + FARPROC originaljoyConfigChanged; + FARPROC originaljoyGetDevCapsA; + FARPROC originaljoyGetDevCapsW; + FARPROC originaljoyGetNumDevs; + FARPROC originaljoyGetPosEx; + FARPROC originaljoyGetPos; + FARPROC originaljoyGetThreshold; + FARPROC originaljoyReleaseCapture; + FARPROC originaljoySetCapture; + FARPROC originaljoySetThreshold; + FARPROC originalmidiConnect; + FARPROC originalmidiDisconnect; + FARPROC originalmidiInAddBuffer; + FARPROC originalmidiInClose; + FARPROC originalmidiInGetDevCapsA; + FARPROC originalmidiInGetDevCapsW; + FARPROC originalmidiInGetErrorTextA; + FARPROC originalmidiInGetErrorTextW; + FARPROC originalmidiInGetID; + FARPROC originalmidiInGetNumDevs; + FARPROC originalmidiInMessage; + FARPROC originalmidiInOpen; + FARPROC originalmidiInPrepareHeader; + FARPROC originalmidiInReset; + FARPROC originalmidiInStart; + FARPROC originalmidiInStop; + FARPROC originalmidiInUnprepareHeader; + FARPROC originalmidiOutCacheDrumPatches; + FARPROC originalmidiOutCachePatches; + FARPROC originalmidiOutClose; + FARPROC originalmidiOutGetDevCapsA; + FARPROC originalmidiOutGetDevCapsW; + FARPROC originalmidiOutGetErrorTextA; + FARPROC originalmidiOutGetErrorTextW; + FARPROC originalmidiOutGetID; + FARPROC originalmidiOutGetNumDevs; + FARPROC originalmidiOutGetVolume; + FARPROC originalmidiOutLongMsg; + FARPROC originalmidiOutOpen; + FARPROC originalmidiOutPrepareHeader; + FARPROC originalmidiOutReset; + FARPROC originalmidiOutSetVolume; + FARPROC originalmidiOutShortMsg; + FARPROC originalmidiOutUnprepareHeader; + FARPROC originalmidiStreamClose; + FARPROC originalmidiStreamOpen; + FARPROC originalmidiStreamOut; + FARPROC originalmidiStreamPause; + FARPROC originalmidiStreamPosition; + FARPROC originalmidiStreamProperty; + FARPROC originalmidiStreamRestart; + FARPROC originalmidiStreamStop; + FARPROC originalmixerClose; + FARPROC originalmixerGetControlDetailsA; + FARPROC originalmixerGetControlDetailsW; + FARPROC originalmixerGetDevCapsA; + FARPROC originalmixerGetDevCapsW; + FARPROC originalmixerGetID; + FARPROC originalmixerGetLineControlsA; + FARPROC originalmixerGetLineControlsW; + FARPROC originalmixerGetLineInfoA; + FARPROC originalmixerGetLineInfoW; + FARPROC originalmixerGetNumDevs; + FARPROC originalmixerMessage; + FARPROC originalmixerOpen; + FARPROC originalmixerSetControlDetails; + FARPROC originalmmDrvInstall; + FARPROC originalmmGetCurrentTask; + FARPROC originalmmTaskBlock; + FARPROC originalmmTaskCreate; + FARPROC originalmmTaskSignal; + FARPROC originalmmTaskYield; + FARPROC originalmmioAdvance; + FARPROC originalmmioAscend; + FARPROC originalmmioClose; + FARPROC originalmmioCreateChunk; + FARPROC originalmmioDescend; + FARPROC originalmmioFlush; + FARPROC originalmmioGetInfo; + FARPROC originalmmioInstallIOProcA; + FARPROC originalmmioInstallIOProcW; + FARPROC originalmmioOpenA; + FARPROC originalmmioOpenW; + FARPROC originalmmioRead; + FARPROC originalmmioRenameA; + FARPROC originalmmioRenameW; + FARPROC originalmmioSeek; + FARPROC originalmmioSendMessage; + FARPROC originalmmioSetBuffer; + FARPROC originalmmioSetInfo; + FARPROC originalmmioStringToFOURCCA; + FARPROC originalmmioStringToFOURCCW; + FARPROC originalmmioWrite; + FARPROC originaltimeEndPeriod; + FARPROC originaltimeGetDevCaps; + FARPROC originaltimeGetSystemTime; + FARPROC originalwaveInAddBuffer; + FARPROC originalwaveInClose; + FARPROC originalwaveInGetDevCapsA; + FARPROC originalwaveInGetDevCapsW; + FARPROC originalwaveInGetErrorTextA; + FARPROC originalwaveInGetErrorTextW; + FARPROC originalwaveInGetID; + FARPROC originalwaveInGetNumDevs; + FARPROC originalwaveInGetPosition; + FARPROC originalwaveInMessage; + FARPROC originalwaveInOpen; + FARPROC originalwaveInPrepareHeader; + FARPROC originalwaveInReset; + FARPROC originalwaveInStart; + FARPROC originalwaveInStop; + FARPROC originalwaveInUnprepareHeader; + FARPROC originalwaveOutBreakLoop; + FARPROC originalwaveOutClose; + FARPROC originalwaveOutGetDevCapsA; + FARPROC originalwaveOutGetDevCapsW; + FARPROC originalwaveOutGetErrorTextA; + FARPROC originalwaveOutGetErrorTextW; + FARPROC originalwaveOutGetID; + FARPROC originalwaveOutGetNumDevs; + FARPROC originalwaveOutGetPitch; + FARPROC originalwaveOutGetPlaybackRate; + FARPROC originalwaveOutGetPosition; + FARPROC originalwaveOutGetVolume; + FARPROC originalwaveOutMessage; + FARPROC originalwaveOutOpen; + FARPROC originalwaveOutPause; + FARPROC originalwaveOutPrepareHeader; + FARPROC originalwaveOutReset; + FARPROC originalwaveOutRestart; + FARPROC originalwaveOutSetPitch; + FARPROC originalwaveOutSetPlaybackRate; + FARPROC originalwaveOutSetVolume; + FARPROC originalwaveOutUnprepareHeader; + FARPROC originalwaveOutWrite; + FARPROC originalmciExecute; + FARPROC originalmciGetErrorStringA; + FARPROC originalmciGetErrorStringW; + FARPROC originalmciSendCommandA; + FARPROC originalmciSendCommandW; + FARPROC originalmciSendStringA; + FARPROC originalmciSendStringW; + FARPROC originalmciFreeCommandResource; + FARPROC originalmciLoadCommandResource; + FARPROC originalmciDriverNotify; + FARPROC originalmciDriverYield; + FARPROC originalmciGetCreatorTask; + FARPROC originalmciGetDeviceIDA; + FARPROC originalmciGetDeviceIDFromElementIDA; + FARPROC originalmciGetDeviceIDFromElementIDW; + FARPROC originalmciGetDeviceIDW; + FARPROC originalmciGetDriverData; + FARPROC originalmciGetYieldProc; + FARPROC originalmciSetDriverData; + FARPROC originalmciSetYieldProc; + FARPROC originalPlaySoundA; + FARPROC originalsndPlaySoundA; + FARPROC originalsndPlaySoundW; + FARPROC originalWOWAppExit; + FARPROC originalmmsystemGetVersion; +} + +// OpenGL32 REAL FUNCTIONS +extern "C" +{ + FARPROC originalwglUseFontOutlinesA; + FARPROC originalwglUseFontOutlinesW; + FARPROC originalwglDescribeLayerPlane; + FARPROC originalwglSetLayerPaletteEntries; + FARPROC originalwglGetLayerPaletteEntries; + FARPROC originalwglRealizeLayerPalette; + FARPROC originalwglSwapLayerBuffers; + FARPROC originalwglMakeCurrent; + FARPROC originalGlmfInitPlayback; + FARPROC originalGlmfBeginGlsBlock; + FARPROC originalGlmfPlayGlsRecord; + FARPROC originalGlmfEndGlsBlock; + FARPROC originalGlmfEndPlayback; + FARPROC originalGlmfCloseMetaFile; + FARPROC originalwglSwapMultipleBuffers; + FARPROC originalwglCreateLayerContext; + FARPROC originalwglCreateContext; + FARPROC originalwglDeleteContext; + FARPROC originalwglGetCurrentContext; + FARPROC originalwglGetCurrentDC; + FARPROC originalwglUseFontBitmapsA; + FARPROC originalwglUseFontBitmapsW; + FARPROC originalwglShareLists; + FARPROC originalwglGetDefaultProcAddress; + FARPROC originalwglGetProcAddress; + FARPROC originalwglCopyContext; + FARPROC originalglDebugEntry; + FARPROC originalwglGetPixelFormat; + FARPROC originalwglSetPixelFormat; + FARPROC originalwglChoosePixelFormat; + FARPROC originalwglDescribePixelFormat; + FARPROC originalwglSwapBuffers; + FARPROC originalglNewList; + FARPROC originalglEndList; + FARPROC originalglCallList; + FARPROC originalglCallLists; + FARPROC originalglBegin; + FARPROC originalglColor3b; + FARPROC originalglColor3bv; + FARPROC originalglColor3d; + FARPROC originalglColor3dv; + FARPROC originalglColor3f; + FARPROC originalglColor3fv; + FARPROC originalglColor3i; + FARPROC originalglColor3iv; + FARPROC originalglColor3s; + FARPROC originalglColor3sv; + FARPROC originalglColor3ub; + FARPROC originalglColor3ubv; + FARPROC originalglColor3ui; + FARPROC originalglColor3uiv; + FARPROC originalglColor3us; + FARPROC originalglColor3usv; + FARPROC originalglColor4b; + FARPROC originalglColor4bv; + FARPROC originalglColor4d; + FARPROC originalglColor4dv; + FARPROC originalglColor4f; + FARPROC originalglColor4fv; + FARPROC originalglColor4i; + FARPROC originalglColor4iv; + FARPROC originalglColor4s; + FARPROC originalglColor4sv; + FARPROC originalglColor4ub; + FARPROC originalglColor4ubv; + FARPROC originalglColor4ui; + FARPROC originalglColor4uiv; + FARPROC originalglColor4us; + FARPROC originalglColor4usv; + FARPROC originalglEdgeFlag; + FARPROC originalglEdgeFlagv; + FARPROC originalglEnd; + FARPROC originalglIndexd; + FARPROC originalglIndexdv; + FARPROC originalglIndexf; + FARPROC originalglIndexfv; + FARPROC originalglIndexi; + FARPROC originalglIndexiv; + FARPROC originalglIndexs; + FARPROC originalglIndexsv; + FARPROC originalglNormal3b; + FARPROC originalglNormal3bv; + FARPROC originalglNormal3d; + FARPROC originalglNormal3dv; + FARPROC originalglNormal3f; + FARPROC originalglNormal3fv; + FARPROC originalglNormal3i; + FARPROC originalglNormal3iv; + FARPROC originalglNormal3s; + FARPROC originalglNormal3sv; + FARPROC originalglTexCoord1d; + FARPROC originalglTexCoord1dv; + FARPROC originalglTexCoord1f; + FARPROC originalglTexCoord1fv; + FARPROC originalglTexCoord1i; + FARPROC originalglTexCoord1iv; + FARPROC originalglTexCoord1s; + FARPROC originalglTexCoord1sv; + FARPROC originalglTexCoord2d; + FARPROC originalglTexCoord2dv; + FARPROC originalglTexCoord2f; + FARPROC originalglTexCoord2fv; + FARPROC originalglTexCoord2i; + FARPROC originalglTexCoord2iv; + FARPROC originalglTexCoord2s; + FARPROC originalglTexCoord2sv; + FARPROC originalglTexCoord3d; + FARPROC originalglTexCoord3dv; + FARPROC originalglTexCoord3f; + FARPROC originalglTexCoord3fv; + FARPROC originalglTexCoord3i; + FARPROC originalglTexCoord3iv; + FARPROC originalglTexCoord3s; + FARPROC originalglTexCoord3sv; + FARPROC originalglTexCoord4d; + FARPROC originalglTexCoord4dv; + FARPROC originalglTexCoord4f; + FARPROC originalglTexCoord4fv; + FARPROC originalglTexCoord4i; + FARPROC originalglTexCoord4iv; + FARPROC originalglTexCoord4s; + FARPROC originalglTexCoord4sv; + FARPROC originalglVertex2d; + FARPROC originalglVertex2dv; + FARPROC originalglVertex2f; + FARPROC originalglVertex2fv; + FARPROC originalglVertex2i; + FARPROC originalglVertex2iv; + FARPROC originalglVertex2s; + FARPROC originalglVertex2sv; + FARPROC originalglVertex3d; + FARPROC originalglVertex3dv; + FARPROC originalglVertex3f; + FARPROC originalglVertex3fv; + FARPROC originalglVertex3i; + FARPROC originalglVertex3iv; + FARPROC originalglVertex3s; + FARPROC originalglVertex3sv; + FARPROC originalglVertex4d; + FARPROC originalglVertex4dv; + FARPROC originalglVertex4f; + FARPROC originalglVertex4fv; + FARPROC originalglVertex4i; + FARPROC originalglVertex4iv; + FARPROC originalglVertex4s; + FARPROC originalglVertex4sv; + FARPROC originalglMaterialf; + FARPROC originalglMaterialfv; + FARPROC originalglMateriali; + FARPROC originalglMaterialiv; + FARPROC originalglDisable; + FARPROC originalglEnable; + FARPROC originalglPopAttrib; + FARPROC originalglPushAttrib; + FARPROC originalglEvalCoord1d; + FARPROC originalglEvalCoord1dv; + FARPROC originalglEvalCoord1f; + FARPROC originalglEvalCoord1fv; + FARPROC originalglEvalCoord2d; + FARPROC originalglEvalCoord2dv; + FARPROC originalglEvalCoord2f; + FARPROC originalglEvalCoord2fv; + FARPROC originalglEvalPoint1; + FARPROC originalglEvalPoint2; + FARPROC originalglLoadIdentity; + FARPROC originalglLoadMatrixf; + FARPROC originalglLoadMatrixd; + FARPROC originalglMatrixMode; + FARPROC originalglMultMatrixf; + FARPROC originalglMultMatrixd; + FARPROC originalglPopMatrix; + FARPROC originalglPushMatrix; + FARPROC originalglRotated; + FARPROC originalglRotatef; + FARPROC originalglScaled; + FARPROC originalglScalef; + FARPROC originalglTranslated; + FARPROC originalglTranslatef; + FARPROC originalglArrayElement; + FARPROC originalglBindTexture; + FARPROC originalglColorPointer; + FARPROC originalglDisableClientState; + FARPROC originalglDrawArrays; + FARPROC originalglDrawElements; + FARPROC originalglEdgeFlagPointer; + FARPROC originalglEnableClientState; + FARPROC originalglIndexPointer; + FARPROC originalglIndexub; + FARPROC originalglIndexubv; + FARPROC originalglInterleavedArrays; + FARPROC originalglNormalPointer; + FARPROC originalglPolygonOffset; + FARPROC originalglTexCoordPointer; + FARPROC originalglVertexPointer; + FARPROC originalglGetPointerv; + FARPROC originalglPopClientAttrib; + FARPROC originalglPushClientAttrib; + FARPROC originalglClear; + FARPROC originalglClearAccum; + FARPROC originalglClearIndex; + FARPROC originalglClearColor; + FARPROC originalglClearStencil; + FARPROC originalglClearDepth; + FARPROC originalglBitmap; + FARPROC originalglTexImage1D; + FARPROC originalglTexImage2D; + FARPROC originalglCopyPixels; + FARPROC originalglReadPixels; + FARPROC originalglDrawPixels; + FARPROC originalglRectd; + FARPROC originalglRectdv; + FARPROC originalglRectf; + FARPROC originalglRectfv; + FARPROC originalglRecti; + FARPROC originalglRectiv; + FARPROC originalglRects; + FARPROC originalglRectsv; + FARPROC originalglDeleteLists; + FARPROC originalglGenLists; + FARPROC originalglListBase; + FARPROC originalglRasterPos2d; + FARPROC originalglRasterPos2dv; + FARPROC originalglRasterPos2f; + FARPROC originalglRasterPos2fv; + FARPROC originalglRasterPos2i; + FARPROC originalglRasterPos2iv; + FARPROC originalglRasterPos2s; + FARPROC originalglRasterPos2sv; + FARPROC originalglRasterPos3d; + FARPROC originalglRasterPos3dv; + FARPROC originalglRasterPos3f; + FARPROC originalglRasterPos3fv; + FARPROC originalglRasterPos3i; + FARPROC originalglRasterPos3iv; + FARPROC originalglRasterPos3s; + FARPROC originalglRasterPos3sv; + FARPROC originalglRasterPos4d; + FARPROC originalglRasterPos4dv; + FARPROC originalglRasterPos4f; + FARPROC originalglRasterPos4fv; + FARPROC originalglRasterPos4i; + FARPROC originalglRasterPos4iv; + FARPROC originalglRasterPos4s; + FARPROC originalglRasterPos4sv; + FARPROC originalglClipPlane; + FARPROC originalglColorMaterial; + FARPROC originalglCullFace; + FARPROC originalglFogf; + FARPROC originalglFogfv; + FARPROC originalglFogi; + FARPROC originalglFogiv; + FARPROC originalglFrontFace; + FARPROC originalglHint; + FARPROC originalglLightf; + FARPROC originalglLightfv; + FARPROC originalglLighti; + FARPROC originalglLightiv; + FARPROC originalglLightModelf; + FARPROC originalglLightModelfv; + FARPROC originalglLightModeli; + FARPROC originalglLightModeliv; + FARPROC originalglLineStipple; + FARPROC originalglLineWidth; + FARPROC originalglPointSize; + FARPROC originalglPolygonMode; + FARPROC originalglPolygonStipple; + FARPROC originalglScissor; + FARPROC originalglFinish; + FARPROC originalglShadeModel; + FARPROC originalglTexParameterf; + FARPROC originalglTexParameterfv; + FARPROC originalglTexParameteri; + FARPROC originalglTexParameteriv; + FARPROC originalglTexEnvf; + FARPROC originalglTexEnvfv; + FARPROC originalglTexEnvi; + FARPROC originalglTexEnviv; + FARPROC originalglTexGend; + FARPROC originalglTexGendv; + FARPROC originalglTexGenf; + FARPROC originalglTexGenfv; + FARPROC originalglTexGeni; + FARPROC originalglTexGeniv; + FARPROC originalglFeedbackBuffer; + FARPROC originalglSelectBuffer; + FARPROC originalglRenderMode; + FARPROC originalglInitNames; + FARPROC originalglLoadName; + FARPROC originalglPassThrough; + FARPROC originalglPopName; + FARPROC originalglPushName; + FARPROC originalglDrawBuffer; + FARPROC originalglStencilMask; + FARPROC originalglColorMask; + FARPROC originalglDepthMask; + FARPROC originalglIndexMask; + FARPROC originalglAccum; + FARPROC originalglFlush; + FARPROC originalglMap1d; + FARPROC originalglMap1f; + FARPROC originalglMap2d; + FARPROC originalglMap2f; + FARPROC originalglMapGrid1d; + FARPROC originalglMapGrid1f; + FARPROC originalglMapGrid2d; + FARPROC originalglMapGrid2f; + FARPROC originalglEvalMesh1; + FARPROC originalglEvalMesh2; + FARPROC originalglAlphaFunc; + FARPROC originalglBlendFunc; + FARPROC originalglLogicOp; + FARPROC originalglStencilFunc; + FARPROC originalglStencilOp; + FARPROC originalglDepthFunc; + FARPROC originalglPixelZoom; + FARPROC originalglPixelTransferf; + FARPROC originalglPixelTransferi; + FARPROC originalglPixelStoref; + FARPROC originalglPixelStorei; + FARPROC originalglPixelMapfv; + FARPROC originalglPixelMapuiv; + FARPROC originalglPixelMapusv; + FARPROC originalglReadBuffer; + FARPROC originalglGetBooleanv; + FARPROC originalglGetClipPlane; + FARPROC originalglGetDoublev; + FARPROC originalglGetError; + FARPROC originalglGetFloatv; + FARPROC originalglGetIntegerv; + FARPROC originalglGetLightfv; + FARPROC originalglGetLightiv; + FARPROC originalglGetMapdv; + FARPROC originalglGetMapfv; + FARPROC originalglGetMapiv; + FARPROC originalglGetMaterialfv; + FARPROC originalglGetMaterialiv; + FARPROC originalglGetPixelMapfv; + FARPROC originalglGetPixelMapuiv; + FARPROC originalglGetPixelMapusv; + FARPROC originalglGetPolygonStipple; + FARPROC originalglGetString; + FARPROC originalglGetTexEnvfv; + FARPROC originalglGetTexEnviv; + FARPROC originalglGetTexGendv; + FARPROC originalglGetTexGenfv; + FARPROC originalglGetTexGeniv; + FARPROC originalglGetTexImage; + FARPROC originalglGetTexParameterfv; + FARPROC originalglGetTexParameteriv; + FARPROC originalglGetTexLevelParameterfv; + FARPROC originalglGetTexLevelParameteriv; + FARPROC originalglIsEnabled; + FARPROC originalglIsList; + FARPROC originalglDepthRange; + FARPROC originalglFrustum; + FARPROC originalglOrtho; + FARPROC originalglViewport; + FARPROC originalglAreTexturesResident; + FARPROC originalglCopyTexImage1D; + FARPROC originalglCopyTexImage2D; + FARPROC originalglCopyTexSubImage1D; + FARPROC originalglCopyTexSubImage2D; + FARPROC originalglDeleteTextures; + FARPROC originalglGenTextures; + FARPROC originalglIsTexture; + FARPROC originalglPrioritizeTextures; + FARPROC originalglTexSubImage1D; + FARPROC originalglTexSubImage2D; +} + +// SUPPORT FOR WRAPPING DIFFERENT LIBRARIES + +enum lib +{ + unknown = 0, + dinput8, + d3d11, + xinput1_3, + d3d9, + opengl32, + winmm, + dinput +}; + +lib currentLibrary = lib::unknown; + +// DINPUT WRAPPER +HRESULT WINAPI DirectInputDirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter) +{ + HRESULT res = originalDirectInputDirectInputCreateA(hinst, dwVersion, ppDI, punkOuter); + return res; +} +HRESULT WINAPI DirectInputDirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW* ppDI, LPUNKNOWN punkOuter) +{ + HRESULT res = originalDirectInputDirectInputCreateW(hinst, dwVersion, ppDI, punkOuter); + return res; +} +HRESULT WINAPI DirectInputDirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter) +{ + HRESULT res = originalDirectInputDirectInputCreateEx(hinst, dwVersion, riidltf, ppvOut, punkOuter); + return res; +} +// DINPUT8 WRAPPER +HRESULT WINAPI DirectInputDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter) +{ + LPVOID val; + HRESULT res = originalDirectInputDirectInput8Create(hinst, dwVersion, riidltf, &val, punkOuter); + *ppvOut = new DirectInputDeviceWrapper(val, (IID_IDirectInput8W == riidltf)); + return res; +} + +HRESULT WINAPI DirectInputDllRegisterServer(void) +{ + return originalDirectInputDllRegisterServer(); +} + +HRESULT WINAPI DirectInputDllUnregisterServer(void) +{ + return originalDirectInputDllUnregisterServer(); +} + +HRESULT WINAPI DirectInputDllCanUnloadNow(void) +{ + return originalDirectInputDllCanUnloadNow(); +} + +HRESULT WINAPI DirectInputDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return originalDirectInputDllGetClassObject(rclsid, riid, ppv); +} + +LPCDIDATAFORMAT WINAPI DirectInputGetdfDIJoystick() +{ + return originalGetdfDIJoystick(); +} + +__declspec(dllexport) void TPValues(float *values, int num); + +void TPValues(float *values, int num) +{ +} + +// global variables +SDL_Haptic* haptic; +SDL_Haptic* haptic2 = NULL; +EffectCollection effects; +EffectConstants effectConst; +Helpers hlp; + +bool keepRunning = true; +float wheel = 0.0f; + +SDL_Joystick* GameController = NULL; +SDL_Haptic* ControllerHaptic = NULL; +SDL_Joystick* GameController2 = NULL; +SDL_Haptic* ControllerHaptic2 = NULL; +HINSTANCE gl_hOriginalDll = NULL; +HINSTANCE gl_hjgtDll = NULL; +HINSTANCE gl_hlibavs = NULL; +int joystick_index1; +int joystick1Index = -1; +int joystick_index2 = -1; + +// settings +wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); +int configMinForce = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForce"), 0, settingsFilename); +int configMaxForce = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForce"), 100, settingsFilename); +int enableLogging = GetPrivateProfileInt(TEXT("Settings"), TEXT("Logging"), 0, settingsFilename); +int EnableRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableRumble"), 0, settingsFilename); +int ReverseRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseRumble"), 0, settingsFilename); +wchar_t *deviceGUIDString = new wchar_t[256]; +int DeviceGUID = GetPrivateProfileString(TEXT("Settings"), TEXT("DeviceGUID"), NULL, deviceGUIDString, 256, settingsFilename); +int configResetFeedback = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFeedback"), 1, settingsFilename); +int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename); +int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFilename); +int configDefaultCentering = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultCentering"), 0, settingsFilename); +int configDefaultFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultFriction"), 0, settingsFilename); +int BeepWhenHook = GetPrivateProfileInt(TEXT("Settings"), TEXT("BeepWhenHook"), 0, settingsFilename); +int AlternativeFFB = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeFFB"), 0, settingsFilename); +int configAlternativeMinForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeft"), 0, settingsFilename); +int configAlternativeMaxForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeft"), 100, settingsFilename); +int configAlternativeMinForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRight"), 0, settingsFilename); +int configAlternativeMaxForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRight"), 100, settingsFilename); +int ForceShowDeviceGUIDMessageBox = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceShowDeviceGUIDMessageBox"), 100, settingsFilename); + +char chainedDLL[256]; + +const int TEST_GAME_CONST = -1; +const int TEST_GAME_SINE = -2; +const int TEST_GAME_FRICTION = -3; +const int TEST_GAME_SPRING = -4; +const int TEST_GAME_HEAVY = -5; +const int TEST_GAME_LOOSE = -6; + +const int DAYTONA_3 = 1; +const int WACKY_RACES = 2; +const int CHASE_HQ_2 = 3; +const int MAME_019932bit = 4; +const int SEGA_RACING_CLASSIC = 5; +const int SEGA_RALLY_3 = 6; +const int FORD_RACING = 7; +const int INITIAL_D_6 = 8; +const int WMMT_5 = 9; +const int FNF_GAME = 10; +const int MARIO_KART_GPDX = 11; +const int OUTRUN_2Fake = 12; +const int BG4_JP = 13; +const int MACH_STORM = 14; +const int AFTER_BURNER_CLIMAX = 15; +const int INITIAL_D_4 = 16; +const int INITIAL_D_7 = 17; +const int INITIAL_D_8 = 18; +const int POKKEN_TOURNAMENT = 19; +const int MARIO_KART_GPDX_110 = 20; +const int Sonic_Sega_AllStars_Racing = 21; +const int INITIAL_D_5 = 23; +const int INITIAL_D_4_Japan = 24; +const int M2_Emulator = 25; +const int Demul_Emulator = 26; +const int GTI_Club_3 = 27; +const int Button_Rumble32bit = 28; +const int Road_Fighters_3D = 29; +const int LGI_3D = 30; +const int LGI_ = 31; +const int MAME_020632bit = 32; +const int MAME_020664bit = 33; +const int MAME_019964bit = 34; +const int OUTRUN_2Real = 35; +const int Button_Rumble64bit = 36; + +HINSTANCE Get_hInstance() +{ + MEMORY_BASIC_INFORMATION mbi; + VirtualQuery(Get_hInstance, &mbi, sizeof(mbi)); + return reinterpret_cast(mbi.AllocationBase); +} + +void Initialize(int device_index) +{ + hlp.log("in initialize"); + SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC); + SDL_JoystickEventState(SDL_ENABLE); + SDL_JoystickUpdate; + char joystick_guid[256]; + sprintf(joystick_guid, "%S", deviceGUIDString); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + hlp.log("numJoysticks = "); + std::string njs = std::to_string(numJoysticks); + hlp.log((char *)njs.c_str()); + for (int i = 0; i< SDL_NumJoysticks(); i++) + { + SDL_Joystick* js = SDL_JoystickOpen(i); + const char* name = SDL_JoystickName(js); + joystick_index1 = SDL_JoystickInstanceID(js); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js); + if (ForceShowDeviceGUIDMessageBox == 1) + { + char text[256]; + SDL_JoystickGetGUIDString(guid, text, 256); + MessageBoxA(NULL, name, "", 0); + MessageBoxA(NULL, text, "", 0); + } + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + hlp.log(text); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js); + SDL_JoystickClose(js); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + joystick1Index = i; + GameController = SDL_JoystickOpen(i); + ControllerHaptic = SDL_HapticOpenFromJoystick(GameController); + break; + } + } + haptic = ControllerHaptic; + if ((SDL_HapticRumbleSupported(haptic) == SDL_TRUE && EnableRumble == 1)) + { + SDL_HapticRumbleInit; + SDL_HapticRumbleInit(ControllerHaptic); + hlp.log("Rumble Init"); + } + hlp.log("disabling all current FFB effects"); + SDL_HapticStopAll(haptic); + hlp.log("setting haptic gain to 100"); + SDL_HapticSetGain(haptic, 100); // HapticSetGain should be between 0 and 100 as per https://wiki.libsdl.org/SDL_HapticSetGain + hlp.log("setting haptic auto center to 0"); + SDL_HapticSetAutocenter(haptic, 0); // 0 disables autocenter https://wiki.libsdl.org/SDL_HapticSetAutocenter + + + SDL_HapticEffect tempEffect; + + hlp.log("creating base effects..."); + + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + tempEffect.type = SDL_HAPTIC_CONSTANT; + tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.constant.direction.dir[0] = -1; //left => right is +1 as per this 2d array explanation: https://wiki.libsdl.org/SDL_HapticDirection + tempEffect.constant.length = configFeedbackLength; // presumably is ms, but is not documented + tempEffect.constant.delay = 0; + tempEffect.constant.level = 9999; // this is an sint16 => -32768 to 32767 + + // Upload the effect + effects.effect_left_id = SDL_HapticNewEffect(haptic, &tempEffect); + + tempEffect.constant.direction.dir[0] = 1; // this is right-side + + effects.effect_right_id = SDL_HapticNewEffect(haptic, &tempEffect); + + tempEffect = SDL_HapticEffect(); + tempEffect.type = SDL_HAPTIC_FRICTION; + tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.condition.delay = 0; + tempEffect.condition.length = 5000; + effects.effect_friction_id = SDL_HapticNewEffect(haptic, &tempEffect); + + tempEffect = SDL_HapticEffect(); + tempEffect.type = SDL_HAPTIC_SINE; + tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN; + effects.effect_sine_id = SDL_HapticNewEffect(haptic, &tempEffect); + + tempEffect = SDL_HapticEffect(); + tempEffect.type = SDL_HAPTIC_SPRING; + tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.condition.delay = 0; + tempEffect.condition.length = 5000; + effects.effect_spring_id = SDL_HapticNewEffect(haptic, &tempEffect); + + // TODO: why don't we just define this as hackFix = true in the other file? + // Was there a reason to put it here? + extern bool hackFix; + hackFix = true; + +} + +using namespace std::chrono; +std::chrono::milliseconds timeOfLastConstantEffect = duration_cast(system_clock::now().time_since_epoch()); +std::chrono::milliseconds timeOfLastFrictionEffect = duration_cast(system_clock::now().time_since_epoch()); +std::chrono::milliseconds timeOfLastSineEffect = duration_cast(system_clock::now().time_since_epoch()); +std::chrono::milliseconds timeOfLastSpringEffect = duration_cast(system_clock::now().time_since_epoch()); +std::string lastConstantEffectHash = ""; +std::string lastFrictionEffectHash = ""; +std::string lastSineEffectHash = ""; +std::string lastSpringEffectHash = ""; + + +void TriggerConstantEffect(int direction, double strength) +{ + if (AlternativeFFB == 1) + { + std::chrono::milliseconds now = duration_cast(system_clock::now().time_since_epoch()); + long long elapsedTime = (std::chrono::duration_cast(now - timeOfLastConstantEffect)).count(); + int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id; + std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction); + + // if the effect is the same as the last effect that was sent AND enough time hasn't elapsed, do nothing + if (effectHash.compare(lastConstantEffectHash) == 0 && elapsedTime < configFeedbackLength) { + return; // same effect, do nothing. + } + + // TODO: investigate if we need this + if (configResetFeedback || strength <= 0.001) { + SDL_HapticStopEffect(haptic, effects.effect_left_id); + SDL_HapticStopEffect(haptic, effects.effect_right_id); + if (strength <= 0.01) { + timeOfLastConstantEffect = now; + lastConstantEffectHash = effectHash; + return; + } + } + + SDL_HapticEffect tempEffect; + + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + tempEffect.type = SDL_HAPTIC_CONSTANT; + tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN; + if (direction == -1) + { + tempEffect.constant.direction.dir[0] = -1; + tempEffect.constant.length = configFeedbackLength; + tempEffect.constant.delay = 0; + SHORT minForce = (SHORT)(strength > 0.001 ? (configAlternativeMinForceLeft / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configAlternativeMaxForceLeft / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT level = (SHORT)(strength * range - minForce); + tempEffect.constant.level = level; + hlp.log((char *)(std::to_string(level)).c_str()); + SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_id, 1); + } + else + { + tempEffect.constant.direction.dir[0] = 1; + tempEffect.constant.length = configFeedbackLength; + tempEffect.constant.delay = 0; + SHORT minForce = (SHORT)(strength > 0.001 ? (configAlternativeMinForceRight / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configAlternativeMaxForceRight / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT level = (SHORT)(strength * range + minForce); + tempEffect.constant.level = level; + hlp.log((char *)(std::to_string(level)).c_str()); + SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_id, 1); + } + timeOfLastConstantEffect = now; + lastConstantEffectHash = effectHash; + } + else + { + std::chrono::milliseconds now = duration_cast(system_clock::now().time_since_epoch()); + long long elapsedTime = (std::chrono::duration_cast(now - timeOfLastConstantEffect)).count(); + int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id; + std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction); + + // if the effect is the same as the last effect that was sent AND enough time hasn't elapsed, do nothing + if (effectHash.compare(lastConstantEffectHash) == 0 && elapsedTime < configFeedbackLength) { + return; // same effect, do nothing. + } + + // TODO: investigate if we need this + if (configResetFeedback || strength <= 0.001) { + SDL_HapticStopEffect(haptic, effects.effect_left_id); + SDL_HapticStopEffect(haptic, effects.effect_right_id); + if (strength <= 0.01) { + timeOfLastConstantEffect = now; + lastConstantEffectHash = effectHash; + return; + } + } + + SDL_HapticEffect tempEffect; + + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + tempEffect.type = SDL_HAPTIC_CONSTANT; + tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.constant.direction.dir[0] = direction; + tempEffect.constant.length = configFeedbackLength; + tempEffect.constant.delay = 0; + SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT level = (SHORT)(strength * range + minForce); + tempEffect.constant.level = level; + hlp.log((char *)(std::to_string(level)).c_str()); + SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_id, 1); + + timeOfLastConstantEffect = now; + lastConstantEffectHash = effectHash; + } +} + +void TriggerFrictionEffectWithDefaultOption(double strength, bool isDefault) { + std::chrono::milliseconds now = duration_cast(system_clock::now().time_since_epoch()); + long long elapsedTime = (std::chrono::duration_cast(now - timeOfLastFrictionEffect)).count(); + std::string effectHash = std::to_string(effects.effect_friction_id) + "_" + std::to_string(strength); + + if (!isDefault) { + // if the effect is the same as the last effect that was sent AND enough time hasn't elapsed, do nothing + if (effectHash.compare(lastFrictionEffectHash) == 0 && elapsedTime < configFeedbackLength) { + return; // same effect, do nothing. + } + + // TODO: investigate if we need this + if (configResetFeedback || strength <= 0.001) { + SDL_HapticStopEffect(haptic, effects.effect_friction_id); + if (strength <= 0.01) { + timeOfLastFrictionEffect = now; + lastFrictionEffectHash = effectHash; + return; + } + } + } + + SDL_HapticEffect tempEffect; + + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + tempEffect.type = SDL_HAPTIC_FRICTION; + tempEffect.condition.type = SDL_HAPTIC_FRICTION; + tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.condition.delay = 0; + tempEffect.condition.length = isDefault ? 0xFFFFFFFF : configFeedbackLength; + tempEffect.condition.direction.dir[0] = 1; // not used + tempEffect.constant.direction.dir[1] = 0; //Y Position + tempEffect.condition.left_sat[0] = 0xFFFF; + tempEffect.condition.right_sat[0] = 0xFFFF; + + SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT coeff = (SHORT)(strength * range + minForce); + + tempEffect.condition.left_coeff[0] = (short)(coeff); + tempEffect.condition.right_coeff[0] = (short)(coeff); + SDL_HapticUpdateEffect(haptic, effects.effect_friction_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_friction_id, 1); + if (!isDefault) { + timeOfLastFrictionEffect = now; + lastFrictionEffectHash = effectHash; + } +} + +void TriggerFrictionEffect(double strength) +{ + TriggerFrictionEffectWithDefaultOption(strength, false); +} + +void TriggerSineEffect(UINT16 period, UINT16 fadePeriod, double strength) +{ + std::chrono::milliseconds now = duration_cast(system_clock::now().time_since_epoch()); + long long elapsedTime = (std::chrono::duration_cast(now - timeOfLastSineEffect)).count(); + std::string effectHash = std::to_string(effects.effect_sine_id) + "_" + std::to_string(period) + "_" + std::to_string(fadePeriod) + "_" + std::to_string(strength); + + // if the effect is the same as the last effect that was sent AND enough time hasn't elapsed, do nothing + if (effectHash.compare(lastSineEffectHash) == 0 && elapsedTime < configFeedbackLength) { + return; // same effect, do nothing. + } + + // TODO: investigate if we need this + if (configResetFeedback || strength <= 0.001) { + SDL_HapticStopEffect(haptic, effects.effect_sine_id); + if (strength <= 0.01) { + timeOfLastSineEffect = now; + lastSineEffectHash = effectHash; + return; + } + } + + SDL_HapticEffect tempEffect; + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + hlp.log("Doing sine..."); + tempEffect.type = SDL_HAPTIC_SINE; + tempEffect.periodic.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.periodic.direction.dir[0] = 1; + tempEffect.constant.direction.dir[1] = 0; //Y Position + tempEffect.periodic.period = period; + + SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT magnitude = (SHORT)(strength * range + minForce); + + tempEffect.periodic.magnitude = (SHORT)(magnitude); + tempEffect.periodic.length = configFeedbackLength; + tempEffect.periodic.attack_length = fadePeriod; + tempEffect.periodic.fade_length = fadePeriod; + + SDL_HapticUpdateEffect(haptic, effects.effect_sine_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_sine_id, 1); + + /*int supported = SDL_HapticEffectSupported(haptic, &tempEffect); + hlp.log((char *)std::to_string(supported).c_str());*/ + + timeOfLastSineEffect = now; + lastSineEffectHash = effectHash; +} + +void TriggerSpringEffectWithDefaultOption(double strength, bool isDefault) { + std::chrono::milliseconds now = duration_cast(system_clock::now().time_since_epoch()); + long long elapsedTime = (std::chrono::duration_cast(now - timeOfLastSpringEffect)).count(); + std::string effectHash = std::to_string(effects.effect_spring_id) + "_" + std::to_string(strength); + + if (!isDefault) { + // if the effect is the same as the last effect that was sent AND enough time hasn't elapsed, do nothing + if (effectHash.compare(lastSpringEffectHash) == 0 && elapsedTime < configFeedbackLength) { + return; // same effect, do nothing. + } + + // TODO: investigate if we need this + if (configResetFeedback || strength <= 0.001) { + SDL_HapticStopEffect(haptic, effects.effect_spring_id); + if (strength <= 0.01) { + timeOfLastSpringEffect = now; + lastSpringEffectHash = effectHash; + return; + } + } + } + + SDL_HapticEffect tempEffect; + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + tempEffect.type = SDL_HAPTIC_SPRING; + tempEffect.condition.type = SDL_HAPTIC_SPRING; + tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.condition.delay = 0; + tempEffect.condition.length = isDefault ? 0xFFFFFFFF : configFeedbackLength; + tempEffect.condition.direction.dir[0] = 1; + tempEffect.constant.direction.dir[1] = 0; //Y Position + + SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT coeff = (SHORT)(strength * range + minForce); + + tempEffect.condition.left_coeff[0] = (short)(coeff); + tempEffect.condition.right_coeff[0] = (short)(coeff); + tempEffect.condition.left_sat[0] = (short)(coeff); //Needed for Logitech G920 wheel + tempEffect.condition.right_sat[0] = (short)(coeff); //Needed for Logitech G920 wheel + tempEffect.condition.center[0] = 0; + + SDL_HapticUpdateEffect(haptic, effects.effect_spring_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_spring_id, 1); + + if (!isDefault) { + timeOfLastSpringEffect = now; + lastSpringEffectHash = effectHash; + } +} + +void TriggerSpringEffectInfinite(double strength) +{ + SDL_HapticEffect tempEffect; + SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect)); + + tempEffect.type = SDL_HAPTIC_SPRING; + tempEffect.condition.type = SDL_HAPTIC_SPRING; + tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN; + tempEffect.condition.delay = 0; + tempEffect.condition.length = SDL_HAPTIC_INFINITY; + tempEffect.condition.direction.dir[0] = 1; + tempEffect.constant.direction.dir[1] = 1; //Y Position + + + SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + SHORT coeff = (SHORT)(strength * range + minForce); + + tempEffect.condition.left_coeff[0] = (short)(coeff); + tempEffect.condition.right_coeff[0] = (short)(coeff); + tempEffect.condition.left_sat[0] = (short)(coeff) * 10; //Needed for Logitech G920 wheel + tempEffect.condition.right_sat[0] = (short)(coeff) * 10; //Needed for Logitech G920 wheel + tempEffect.condition.center[0] = 0; + + SDL_HapticUpdateEffect(haptic, effects.effect_spring_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_spring_id, 1); +} + +void TriggerLeftRightEffect(double smallstrength, double largestrength, double length) +{ + if (EnableRumble == 1) + { + if (ReverseRumble == 0) + { + SDL_HapticEffect tempEffect; + tempEffect.type = SDL_HAPTIC_LEFTRIGHT; + tempEffect.leftright.length = length; + SHORT minForce = (SHORT)(smallstrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + tempEffect.leftright.small_magnitude = (SHORT)(smallstrength * range + minForce); + SHORT minForce1 = (SHORT)(largestrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce1 = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range1 = maxForce1 - minForce1; + tempEffect.leftright.large_magnitude = (SHORT)(largestrength * range1 + minForce1); + SDL_HapticUpdateEffect(haptic, effects.effect_leftright_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_leftright_id, 1); + } + else if (ReverseRumble == 1) + { + SDL_HapticEffect tempEffect; + tempEffect.type = SDL_HAPTIC_LEFTRIGHT; + tempEffect.leftright.length = length; + SHORT minForce = (SHORT)(largestrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + tempEffect.leftright.small_magnitude = (SHORT)(largestrength * range + minForce); + SHORT minForce1 = (SHORT)(smallstrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce1 = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range1 = maxForce1 - minForce1; + tempEffect.leftright.large_magnitude = (SHORT)(smallstrength * range1 + minForce1); + SDL_HapticUpdateEffect(haptic, effects.effect_leftright_id, &tempEffect); + SDL_HapticRunEffect(haptic, effects.effect_leftright_id, 1); + } + } +} + +void TriggerLeftRightDevice2Effect(double smallstrength, double largestrength, double length) +{ + if (EnableRumble == 1) + { + if (ReverseRumble == 0) + { + SDL_HapticEffect tempEffect; + tempEffect.type = SDL_HAPTIC_LEFTRIGHT; + tempEffect.leftright.length = length; + SHORT minForce = (SHORT)(smallstrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + tempEffect.leftright.small_magnitude = (SHORT)(smallstrength * range + minForce); + SHORT minForce1 = (SHORT)(largestrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce1 = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range1 = maxForce1 - minForce1; + tempEffect.leftright.large_magnitude = (SHORT)(largestrength * range1 + minForce1); + SDL_HapticUpdateEffect(haptic2, effects.effect_leftright_id, &tempEffect); + SDL_HapticRunEffect(haptic2, effects.effect_leftright_id, 1); + } + else if (ReverseRumble == 1) + { + SDL_HapticEffect tempEffect; + tempEffect.type = SDL_HAPTIC_LEFTRIGHT; + tempEffect.leftright.length = length; + SHORT minForce = (SHORT)(largestrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range = maxForce - minForce; + tempEffect.leftright.small_magnitude = (SHORT)(largestrength * range + minForce); + SHORT minForce1 = (SHORT)(smallstrength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0. + SHORT maxForce1 = (SHORT)(configMaxForce / 100.0 * 32767.0); + SHORT range1 = maxForce1 - minForce1; + tempEffect.leftright.large_magnitude = (SHORT)(smallstrength * range1 + minForce1); + SDL_HapticUpdateEffect(haptic2, effects.effect_leftright_id, &tempEffect); + SDL_HapticRunEffect(haptic2, effects.effect_leftright_id, 1); + } + } +} + +void TriggerRumbleEffect(double strength, double length) +{ + if (EnableRumble == 1) + { + SDL_HapticRumblePlay(haptic, strength, length); + } +} + + +void TriggerSpringEffect(double strength) +{ + TriggerSpringEffectWithDefaultOption(strength, false); +} + +DWORD WINAPI FFBLoop(LPVOID lpParam) +{ + + hlp.log("In FFBLoop"); + Sleep(2500); + SDL_HapticStopAll(haptic); + Initialize(0); + hlp.log("Initialize() complete"); + + // assign FFB effects here + EffectTriggers t; + t.Constant = &TriggerConstantEffect; + t.Spring = &TriggerSpringEffect; + t.Friction = &TriggerFrictionEffect; + t.Sine = &TriggerSineEffect; + t.Rumble = &TriggerRumbleEffect; + t.LeftRight = &TriggerLeftRightEffect; + t.LeftRightDevice2 = &TriggerLeftRightDevice2Effect; + t.Springi = &TriggerSpringEffectInfinite; + + Game* game; + switch (configGameId) { + case AFTER_BURNER_CLIMAX: + game = new AfterburnerClimax; + break; + case CHASE_HQ_2: + game = new ChaseHQ2; + break; + case DAYTONA_3: + game = new Daytona3; + break; + case FNF_GAME: + game = new FNF; + break; + case FORD_RACING: + game = new FordRacing; + break; + case INITIAL_D_4: + game = new InitialD4; + break; + case INITIAL_D_4_Japan: + game = new InitialD4Japan; + break; + case INITIAL_D_5: + game = new InitialD5; + break; + case INITIAL_D_6: + game = new InitialD6; + break; + case INITIAL_D_7: + game = new InitialD7; + break; + case INITIAL_D_8: + game = new InitialD8; + break; + case SEGA_RACING_CLASSIC: + game = new SegaRacingClassic; + break; + case SEGA_RALLY_3: + game = new SegaRally3; + break; + case MAME_019932bit: + game = new Mame019932bit; + break; + case MAME_019964bit: + game = new Mame019964bit; + break; + case WACKY_RACES: + game = new WackyRaces; + break; + case WMMT_5: + game = new WMMT5; + break; + case MARIO_KART_GPDX: + game = new MarioKartGPDX100; + break; + case OUTRUN_2Fake: + game = new OutRun2Fake; + break; + case OUTRUN_2Real: + game = new OutRun2Real; + break; + case BG4_JP: + game = new BG4JP; + break; + case MACH_STORM: + game = new Machstorm; + break; + case POKKEN_TOURNAMENT: + game = new PokkenTournament; + break; + case MARIO_KART_GPDX_110: + game = new MarioKartGPDX110; + break; + case Sonic_Sega_AllStars_Racing: + game = new SonicSegaAllStarsRacing; + break; + case M2_Emulator: + game = new M2Emulator; + break; + case Demul_Emulator: + game = new Demul; + break; + case GTI_Club_3: + game = new GTIClub3; + break; + case Button_Rumble32bit: + game = new ButtonRumble32bit; + break; + case Button_Rumble64bit: + game = new ButtonRumble64bit; + break; + case Road_Fighters_3D: + game = new RoadFighters3D; + break; + case LGI_3D: + game = new LGI3D; + break; + case LGI_: + game = new LGI; + break; + case MAME_020632bit: + game = new Mame020632bit; + break; + case MAME_020664bit: + game = new Mame020664bit; + break; + case TEST_GAME_CONST: + case TEST_GAME_FRICTION: + case TEST_GAME_SINE: + case TEST_GAME_SPRING: + case TEST_GAME_HEAVY: + case TEST_GAME_LOOSE: + game = new TestGame; + break; + default: + game = 0; + } + hlp.log("Setting DefaultCentering & DefaultFriction forces..."); + if (configDefaultCentering >= 0 && configDefaultCentering <= 100) { + TriggerSpringEffectWithDefaultOption(configDefaultCentering / 100.0, true); + } + if (configDefaultFriction >= 0 && configDefaultFriction <= 100) { + TriggerFrictionEffectWithDefaultOption(configDefaultFriction / 100.0, true); + } + + hlp.log("Entering Game's FFBLoop loop"); + bool* kr = (bool*)lpParam; + while (*kr) + { + game->FFBLoop(&effectConst, &hlp, &t); + Sleep(16); + } + hlp.log("about to exit FFBLoop"); + return 0; +} + +void CreateFFBLoopThread() +{ + hlp.log("Before CreateThread"); + CreateThread(NULL, 0, FFBLoop, (LPVOID)&keepRunning, 0, NULL); + hlp.log("After CreateThread"); +} + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved) +{ + BOOL result = TRUE; + hlp.enableLogging = enableLogging; + char buff[MAX_PATH]; + hlp.log("DLLMAIN ENTERED"); + GetModuleFileNameA(NULL, buff, MAX_PATH); + std::string processName = std::string(buff); + hlp.log("process name:"); + hlp.log((char *)processName.c_str()); + hlp.log("default centering & friction values:"); + hlp.logInt(configDefaultCentering); + hlp.logInt(configDefaultFriction); + + switch (ulReasonForCall) + { + case DLL_PROCESS_ATTACH: + // log, etc. + hlp.log("dll process attach:"); + hlp.log((char *)processName.c_str()); + hlp.log((char *)(std::to_string(configMinForce)).c_str()); + hlp.log((char *)(std::to_string(configMaxForce)).c_str()); + DisableThreadLibraryCalls(hModule); + + hlp.log("loading original library..."); + + GetPrivateProfileStringA("Settings", "ChainLoad", "", chainedDLL, 256, ".\\FFBplugin.ini"); + + if (0 == strlen(chainedDLL)) + { + char buffer[MAX_PATH]; + GetSystemDirectoryA(buffer, MAX_PATH); + + char libName[256]; + GetModuleFileNameA(hModule, libName, 256); + _strupr(libName); + if (NULL != strstr(libName, "DINPUT8")) + { + currentLibrary = lib::dinput8; + strcat_s(buffer, MAX_PATH, "\\dinput8.dll"); + } + else if (NULL != strstr(libName, "DINPUT")) + { + currentLibrary = lib::dinput; + strcat_s(buffer, MAX_PATH, "\\dinput.dll"); + } + if (NULL != strstr(libName, "D3D11")) + { + currentLibrary = lib::d3d11; + strcat_s(buffer, MAX_PATH, "\\d3d11.dll"); + } + if (NULL != strstr(libName, "XINPUT1_3")) + { + currentLibrary = lib::xinput1_3; + strcat_s(buffer, MAX_PATH, "\\xinput1_3.dll"); + } + if (NULL != strstr(libName, "OPENGL32")) + { + currentLibrary = lib::opengl32; + strcat_s(buffer, MAX_PATH, "\\opengl32.dll"); + } + if (NULL != strstr(libName, "D3D9")) + { + currentLibrary = lib::d3d9; + strcat_s(buffer, MAX_PATH, "\\d3d9.dll"); + } + if (NULL != strstr(libName, "WINMM")) + { + currentLibrary = lib::winmm; + strcat_s(buffer, MAX_PATH, "\\winmm.dll"); + } + hlp.log(buffer); + gl_hOriginalDll = LoadLibraryA(buffer); + if (configGameId == 29) + { + gl_hjgtDll = LoadLibraryA("jgt.dll"); + gl_hlibavs = LoadLibraryA("libavs-win32-ea3.dll"); + } + } + else + { + hlp.log(chainedDLL); + gl_hOriginalDll = LoadLibraryA(chainedDLL); + // e.g. ChainLoad = dinput8-old.dll (if we need to intercept another dinput8.dll file). + } + + if (!gl_hOriginalDll) + { + hlp.log("library load process failed"); + ExitProcess(0); + } + else { + hlp.log("library loaded"); + } + + if (currentLibrary == lib::dinput8) + { + originalDirectInputDirectInput8Create = (pfnDirectInputDirectInput8Create)GetProcAddress(gl_hOriginalDll, "DirectInput8Create"); + originalDirectInputDllRegisterServer = (pfnDirectInputDllRegisterServer)GetProcAddress(gl_hOriginalDll, "DllRegisterServer"); + originalDirectInputDllUnregisterServer = (pfnDirectInputDllUnregisterServer)GetProcAddress(gl_hOriginalDll, "DllUnregisterServer"); + originalDirectInputDllCanUnloadNow = (pfnDirectInputDllCanUnloadNow)GetProcAddress(gl_hOriginalDll, "DllCanUnloadNow"); + originalDirectInputDllGetClassObject = (pfnDirectInputDllGetClassObject)GetProcAddress(gl_hOriginalDll, "DllGetClassObject"); + originalGetdfDIJoystick = (pfnDirectInputGetdfDIJoystick)GetProcAddress(gl_hOriginalDll, "GetdfDIJoystick"); + } + + if (currentLibrary == lib::dinput) + { + originalDirectInputDllRegisterServer = (pfnDirectInputDllRegisterServer)GetProcAddress(gl_hOriginalDll, "DllRegisterServer"); + originalDirectInputDllUnregisterServer = (pfnDirectInputDllUnregisterServer)GetProcAddress(gl_hOriginalDll, "DllUnregisterServer"); + originalDirectInputDllCanUnloadNow = (pfnDirectInputDllCanUnloadNow)GetProcAddress(gl_hOriginalDll, "DllCanUnloadNow"); + originalDirectInputDllGetClassObject = (pfnDirectInputDllGetClassObject)GetProcAddress(gl_hOriginalDll, "DllGetClassObject"); + originalDirectInputDirectInputCreateA = (pfnDirectInputDirectInputCreateA)GetProcAddress(gl_hOriginalDll, "DirectInputCreateA"); + originalDirectInputDirectInputCreateW = (pfnDirectInputDirectInputCreateW)GetProcAddress(gl_hOriginalDll, "DirectInputCreateW"); + originalDirectInputDirectInputCreateEx = (pfnDirectInputDirectInputCreateEx)GetProcAddress(gl_hOriginalDll, "DirectInputCreateEx"); + } + + if (currentLibrary == lib::d3d11) + { + originalCreateDirect3D11DeviceFromDXGIDevice = GetProcAddress(gl_hOriginalDll, "CreateDirect3D11DeviceFromDXGIDevice"); + originalCreateDirect3D11SurfaceFromDXGISurface = GetProcAddress(gl_hOriginalDll, "CreateDirect3D11SurfaceFromDXGISurface"); + originalD3D11CoreCreateDevice = GetProcAddress(gl_hOriginalDll, "D3D11CoreCreateDevice"); + originalD3D11CoreCreateLayeredDevice = GetProcAddress(gl_hOriginalDll, "D3D11CoreCreateLayeredDevice"); + originalD3D11CoreGetLayeredDeviceSize = GetProcAddress(gl_hOriginalDll, "D3D11CoreGetLayeredDeviceSize"); + originalD3D11CoreRegisterLayers = GetProcAddress(gl_hOriginalDll, "D3D11CoreRegisterLayers"); + originalD3D11CreateDevice = GetProcAddress(gl_hOriginalDll, "D3D11CreateDevice"); + originalD3D11CreateDeviceAndSwapChain = GetProcAddress(gl_hOriginalDll, "D3D11CreateDeviceAndSwapChain"); + originalD3D11CreateDeviceForD3D12 = GetProcAddress(gl_hOriginalDll, "D3D11CreateDeviceForD3D12"); + originalD3D11On12CreateDevice = GetProcAddress(gl_hOriginalDll, "D3D11On12CreateDevice"); + originalD3DKMTCloseAdapter = GetProcAddress(gl_hOriginalDll, "D3DKMTCloseAdapter"); + originalD3DKMTCreateAllocation = GetProcAddress(gl_hOriginalDll, "D3DKMTCreateAllocation"); + originalD3DKMTCreateContext = GetProcAddress(gl_hOriginalDll, "D3DKMTCreateContext"); + originalD3DKMTCreateDevice = GetProcAddress(gl_hOriginalDll, "D3DKMTCreateDevice"); + originalD3DKMTCreateSynchronizationObject = GetProcAddress(gl_hOriginalDll, "D3DKMTCreateSynchronizationObject"); + originalD3DKMTDestroyAllocation = GetProcAddress(gl_hOriginalDll, "D3DKMTDestroyAllocation"); + originalD3DKMTDestroyContext = GetProcAddress(gl_hOriginalDll, "D3DKMTDestroyContext"); + originalD3DKMTDestroyDevice = GetProcAddress(gl_hOriginalDll, "D3DKMTDestroyDevice"); + originalD3DKMTDestroySynchronizationObject = GetProcAddress(gl_hOriginalDll, "D3DKMTDestroySynchronizationObject"); + originalD3DKMTEscape = GetProcAddress(gl_hOriginalDll, "D3DKMTEscape"); + originalD3DKMTGetContextSchedulingPriority = GetProcAddress(gl_hOriginalDll, "D3DKMTGetContextSchedulingPriority"); + originalD3DKMTGetDeviceState = GetProcAddress(gl_hOriginalDll, "D3DKMTGetDeviceState"); + originalD3DKMTGetDisplayModeList = GetProcAddress(gl_hOriginalDll, "D3DKMTGetDisplayModeList"); + originalD3DKMTGetMultisampleMethodList = GetProcAddress(gl_hOriginalDll, "D3DKMTGetMultisampleMethodList"); + originalD3DKMTGetRuntimeData = GetProcAddress(gl_hOriginalDll, "D3DKMTGetRuntimeData"); + originalD3DKMTGetSharedPrimaryHandle = GetProcAddress(gl_hOriginalDll, "D3DKMTGetSharedPrimaryHandle"); + originalD3DKMTLock = GetProcAddress(gl_hOriginalDll, "D3DKMTLock"); + originalD3DKMTOpenAdapterFromHdc = GetProcAddress(gl_hOriginalDll, "D3DKMTOpenAdapterFromHdc"); + originalD3DKMTOpenResource = GetProcAddress(gl_hOriginalDll, "D3DKMTOpenResource"); + originalD3DKMTPresent = GetProcAddress(gl_hOriginalDll, "D3DKMTPresent"); + originalD3DKMTQueryAdapterInfo = GetProcAddress(gl_hOriginalDll, "D3DKMTQueryAdapterInfo"); + originalD3DKMTQueryAllocationResidency = GetProcAddress(gl_hOriginalDll, "D3DKMTQueryAllocationResidency"); + originalD3DKMTQueryResourceInfo = GetProcAddress(gl_hOriginalDll, "D3DKMTQueryResourceInfo"); + originalD3DKMTRender = GetProcAddress(gl_hOriginalDll, "D3DKMTRender"); + originalD3DKMTSetAllocationPriority = GetProcAddress(gl_hOriginalDll, "D3DKMTSetAllocationPriority"); + originalD3DKMTSetContextSchedulingPriority = GetProcAddress(gl_hOriginalDll, "D3DKMTSetContextSchedulingPriority"); + originalD3DKMTSetDisplayMode = GetProcAddress(gl_hOriginalDll, "D3DKMTSetDisplayMode"); + originalD3DKMTSetDisplayPrivateDriverFormat = GetProcAddress(gl_hOriginalDll, "D3DKMTSetDisplayPrivateDriverFormat"); + originalD3DKMTSetGammaRamp = GetProcAddress(gl_hOriginalDll, "D3DKMTSetGammaRamp"); + originalD3DKMTSetVidPnSourceOwner = GetProcAddress(gl_hOriginalDll, "D3DKMTSetVidPnSourceOwner"); + originalD3DKMTSignalSynchronizationObject = GetProcAddress(gl_hOriginalDll, "D3DKMTSignalSynchronizationObject"); + originalD3DKMTUnlock = GetProcAddress(gl_hOriginalDll, "D3DKMTUnlock"); + originalD3DKMTWaitForSynchronizationObject = GetProcAddress(gl_hOriginalDll, "D3DKMTWaitForSynchronizationObject"); + originalD3DKMTWaitForVerticalBlankEvent = GetProcAddress(gl_hOriginalDll, "D3DKMTWaitForVerticalBlankEvent"); + originalD3DPerformance_BeginEvent = GetProcAddress(gl_hOriginalDll, "D3DPerformance_BeginEvent"); + originalD3DPerformance_EndEvent = GetProcAddress(gl_hOriginalDll, "D3DPerformance_EndEvent"); + originalD3DPerformance_GetStatus = GetProcAddress(gl_hOriginalDll, "D3DPerformance_GetStatus"); + originalD3DPerformance_SetMarker = GetProcAddress(gl_hOriginalDll, "D3DPerformance_SetMarker"); + originalEnableFeatureLevelUpgrade = GetProcAddress(gl_hOriginalDll, "EnableFeatureLevelUpgrade"); + originalOpenAdapter10 = GetProcAddress(gl_hOriginalDll, "OpenAdapter10"); + originalOpenAdapter10_2 = GetProcAddress(gl_hOriginalDll, "OpenAdapter10_2"); + } + + if (currentLibrary == lib::xinput1_3) + { + originalXInputGetState = GetProcAddress(gl_hOriginalDll, "XInputGetState"); + originalXInputSetState = GetProcAddress(gl_hOriginalDll, "XInputSetState"); + originalXInputGetCapabilities = GetProcAddress(gl_hOriginalDll, "XInputGetCapabilities"); + originalXInputEnable = GetProcAddress(gl_hOriginalDll, "XInputEnable"); + originalXInputGetDSoundAudioDeviceGuids = GetProcAddress(gl_hOriginalDll, "XInputGetDSoundAudioDeviceGuids"); + originalXInputGetBatteryInformation = GetProcAddress(gl_hOriginalDll, "XInputGetBatteryInformation"); + originalXInputGetKeystroke = GetProcAddress(gl_hOriginalDll, "XInputGetKeystroke"); + originalXInputGetStateEx = GetProcAddress(gl_hOriginalDll, MAKEINTRESOURCEA(100)); + originalXInputWaitForGuideButton = GetProcAddress(gl_hOriginalDll, MAKEINTRESOURCEA(101)); + originalXInputCancelGuideButtonWait = GetProcAddress(gl_hOriginalDll, MAKEINTRESOURCEA(102)); + originalXInputPowerOffController = GetProcAddress(gl_hOriginalDll, MAKEINTRESOURCEA(103)); + } + + if (currentLibrary == lib::d3d9) + { + originalDirect3DShaderValidatorCreate9 = GetProcAddress(gl_hOriginalDll, "Direct3DShaderValidatorCreate9"); + originalPSGPError = GetProcAddress(gl_hOriginalDll, "PSGPError"); + originalPSGPSampleTexture = GetProcAddress(gl_hOriginalDll, "PSGPSampleTexture"); + originalD3DPERF_BeginEvent = GetProcAddress(gl_hOriginalDll, "D3DPERF_BeginEvent"); + originalD3DPERF_EndEvent = GetProcAddress(gl_hOriginalDll, "D3DPERF_EndEvent"); + originalD3DPERF_GetStatus = GetProcAddress(gl_hOriginalDll, "D3DPERF_GetStatus"); + originalD3DPERF_QueryRepeatFrame = GetProcAddress(gl_hOriginalDll, "D3DPERF_QueryRepeatFrame"); + originalD3DPERF_SetMarker = GetProcAddress(gl_hOriginalDll, "D3DPERF_SetMarker"); + originalD3DPERF_SetOptions = GetProcAddress(gl_hOriginalDll, "D3DPERF_SetOptions"); + originalD3DPERF_SetRegion = GetProcAddress(gl_hOriginalDll, "D3DPERF_SetRegion"); + originalDebugSetLevel = GetProcAddress(gl_hOriginalDll, "DebugSetLevel"); + originalDebugSetMute = GetProcAddress(gl_hOriginalDll, "DebugSetMute"); + originalDirect3D9EnableMaximizedWindowedModeShim = GetProcAddress(gl_hOriginalDll, "Direct3D9EnableMaximizedWindowedModeShim"); + originalDirect3DCreate9 = GetProcAddress(gl_hOriginalDll, "Direct3DCreate9"); + originalDirect3DCreate9Ex = GetProcAddress(gl_hOriginalDll, "Direct3DCreate9Ex"); + } + + if (currentLibrary == lib::opengl32) + { + originalwglUseFontOutlinesA = GetProcAddress(gl_hOriginalDll, "wglUseFontOutlinesA"); + originalwglUseFontOutlinesW = GetProcAddress(gl_hOriginalDll, "wglUseFontOutlinesW"); + originalwglDescribeLayerPlane = GetProcAddress(gl_hOriginalDll, "wglDescribeLayerPlane"); + originalwglSetLayerPaletteEntries = GetProcAddress(gl_hOriginalDll, "wglSetLayerPaletteEntries"); + originalwglGetLayerPaletteEntries = GetProcAddress(gl_hOriginalDll, "wglGetLayerPaletteEntries"); + originalwglRealizeLayerPalette = GetProcAddress(gl_hOriginalDll, "wglRealizeLayerPalette"); + originalwglSwapLayerBuffers = GetProcAddress(gl_hOriginalDll, "wglSwapLayerBuffers"); + originalwglMakeCurrent = GetProcAddress(gl_hOriginalDll, "wglMakeCurrent"); + originalGlmfInitPlayback = GetProcAddress(gl_hOriginalDll, "GlmfInitPlayback"); + originalGlmfBeginGlsBlock = GetProcAddress(gl_hOriginalDll, "GlmfBeginGlsBlock"); + originalGlmfPlayGlsRecord = GetProcAddress(gl_hOriginalDll, "GlmfPlayGlsRecord"); + originalGlmfEndGlsBlock = GetProcAddress(gl_hOriginalDll, "GlmfEndGlsBlock"); + originalGlmfEndPlayback = GetProcAddress(gl_hOriginalDll, "GlmfEndPlayback"); + originalGlmfCloseMetaFile = GetProcAddress(gl_hOriginalDll, "GlmfCloseMetaFile"); + originalwglSwapMultipleBuffers = GetProcAddress(gl_hOriginalDll, "wglSwapMultipleBuffers"); + originalwglCreateLayerContext = GetProcAddress(gl_hOriginalDll, "wglCreateLayerContext"); + originalwglCreateContext = GetProcAddress(gl_hOriginalDll, "wglCreateContext"); + originalwglDeleteContext = GetProcAddress(gl_hOriginalDll, "wglDeleteContext"); + originalwglGetCurrentContext = GetProcAddress(gl_hOriginalDll, "wglGetCurrentContext"); + originalwglGetCurrentDC = GetProcAddress(gl_hOriginalDll, "wglGetCurrentDC"); + originalwglUseFontBitmapsA = GetProcAddress(gl_hOriginalDll, "wglUseFontBitmapsA"); + originalwglUseFontBitmapsW = GetProcAddress(gl_hOriginalDll, "wglUseFontBitmapsW"); + originalwglShareLists = GetProcAddress(gl_hOriginalDll, "wglShareLists"); + originalwglGetDefaultProcAddress = GetProcAddress(gl_hOriginalDll, "wglGetDefaultProcAddress"); + originalwglGetProcAddress = GetProcAddress(gl_hOriginalDll, "wglGetProcAddress"); + originalwglCopyContext = GetProcAddress(gl_hOriginalDll, "wglCopyContext"); + originalglDebugEntry = GetProcAddress(gl_hOriginalDll, "glDebugEntry"); + originalwglGetPixelFormat = GetProcAddress(gl_hOriginalDll, "wglGetPixelFormat"); + originalwglSetPixelFormat = GetProcAddress(gl_hOriginalDll, "wglSetPixelFormat"); + originalwglChoosePixelFormat = GetProcAddress(gl_hOriginalDll, "wglChoosePixelFormat"); + originalwglDescribePixelFormat = GetProcAddress(gl_hOriginalDll, "wglDescribePixelFormat"); + originalwglSwapBuffers = GetProcAddress(gl_hOriginalDll, "wglSwapBuffers"); + originalglCallList = GetProcAddress(gl_hOriginalDll, "glCallList"); + originalglCallLists = GetProcAddress(gl_hOriginalDll, "glCallLists"); + originalglBegin = GetProcAddress(gl_hOriginalDll, "glBegin"); + originalglColor3b = GetProcAddress(gl_hOriginalDll, "glColor3b"); + originalglColor3bv = GetProcAddress(gl_hOriginalDll, "glColor3bv"); + originalglColor3d = GetProcAddress(gl_hOriginalDll, "glColor3d"); + originalglColor3dv = GetProcAddress(gl_hOriginalDll, "glColor3dv"); + originalglColor3f = GetProcAddress(gl_hOriginalDll, "glColor3f"); + originalglColor3fv = GetProcAddress(gl_hOriginalDll, "glColor3fv"); + originalglColor3i = GetProcAddress(gl_hOriginalDll, "glColor3i"); + originalglColor3iv = GetProcAddress(gl_hOriginalDll, "glColor3iv"); + originalglColor3s = GetProcAddress(gl_hOriginalDll, "glColor3s"); + originalglColor3sv = GetProcAddress(gl_hOriginalDll, "glColor3sv"); + originalglColor3ub = GetProcAddress(gl_hOriginalDll, "glColor3ub"); + originalglColor3ubv = GetProcAddress(gl_hOriginalDll, "glColor3ubv"); + originalglColor3ui = GetProcAddress(gl_hOriginalDll, "glColor3ui"); + originalglColor3uiv = GetProcAddress(gl_hOriginalDll, "glColor3uiv"); + originalglColor3us = GetProcAddress(gl_hOriginalDll, "glColor3us"); + originalglColor3usv = GetProcAddress(gl_hOriginalDll, "glColor3usv"); + originalglColor4b = GetProcAddress(gl_hOriginalDll, "glColor4b"); + originalglColor4bv = GetProcAddress(gl_hOriginalDll, "glColor4bv"); + originalglColor4d = GetProcAddress(gl_hOriginalDll, "glColor4d"); + originalglColor4dv = GetProcAddress(gl_hOriginalDll, "glColor4dv"); + originalglColor4f = GetProcAddress(gl_hOriginalDll, "glColor4f"); + originalglColor4fv = GetProcAddress(gl_hOriginalDll, "glColor4fv"); + originalglColor4i = GetProcAddress(gl_hOriginalDll, "glColor4i"); + originalglColor4iv = GetProcAddress(gl_hOriginalDll, "glColor4iv"); + originalglColor4s = GetProcAddress(gl_hOriginalDll, "glColor4s"); + originalglColor4sv = GetProcAddress(gl_hOriginalDll, "glColor4sv"); + originalglColor4ub = GetProcAddress(gl_hOriginalDll, "glColor4ub"); + originalglColor4ubv = GetProcAddress(gl_hOriginalDll, "glColor4ubv"); + originalglColor4ui = GetProcAddress(gl_hOriginalDll, "glColor4ui"); + originalglColor4uiv = GetProcAddress(gl_hOriginalDll, "glColor4uiv"); + originalglColor4us = GetProcAddress(gl_hOriginalDll, "glColor4us"); + originalglColor4usv = GetProcAddress(gl_hOriginalDll, "glColor4usv"); + originalglEdgeFlag = GetProcAddress(gl_hOriginalDll, "glEdgeFlag"); + originalglEdgeFlagv = GetProcAddress(gl_hOriginalDll, "glEdgeFlagv"); + originalglEnd = GetProcAddress(gl_hOriginalDll, "glEnd"); + originalglIndexd = GetProcAddress(gl_hOriginalDll, "glIndexd"); + originalglIndexdv = GetProcAddress(gl_hOriginalDll, "glIndexdv"); + originalglIndexf = GetProcAddress(gl_hOriginalDll, "glIndexf"); + originalglIndexfv = GetProcAddress(gl_hOriginalDll, "glIndexfv"); + originalglIndexi = GetProcAddress(gl_hOriginalDll, "glIndexi"); + originalglIndexiv = GetProcAddress(gl_hOriginalDll, "glIndexiv"); + originalglIndexs = GetProcAddress(gl_hOriginalDll, "glIndexs"); + originalglIndexsv = GetProcAddress(gl_hOriginalDll, "glIndexsv"); + originalglNormal3b = GetProcAddress(gl_hOriginalDll, "glNormal3b"); + originalglNormal3bv = GetProcAddress(gl_hOriginalDll, "glNormal3bv"); + originalglNormal3d = GetProcAddress(gl_hOriginalDll, "glNormal3d"); + originalglNormal3dv = GetProcAddress(gl_hOriginalDll, "glNormal3dv"); + originalglNormal3f = GetProcAddress(gl_hOriginalDll, "glNormal3f"); + originalglNormal3fv = GetProcAddress(gl_hOriginalDll, "glNormal3fv"); + originalglNormal3i = GetProcAddress(gl_hOriginalDll, "glNormal3i"); + originalglNormal3iv = GetProcAddress(gl_hOriginalDll, "glNormal3iv"); + originalglNormal3s = GetProcAddress(gl_hOriginalDll, "glNormal3s"); + originalglNormal3sv = GetProcAddress(gl_hOriginalDll, "glNormal3sv"); + originalglTexCoord1d = GetProcAddress(gl_hOriginalDll, "glTexCoord1d"); + originalglTexCoord1dv = GetProcAddress(gl_hOriginalDll, "glTexCoord1dv"); + originalglTexCoord1f = GetProcAddress(gl_hOriginalDll, "glTexCoord1f"); + originalglTexCoord1fv = GetProcAddress(gl_hOriginalDll, "glTexCoord1fv"); + originalglTexCoord1i = GetProcAddress(gl_hOriginalDll, "glTexCoord1i"); + originalglTexCoord1iv = GetProcAddress(gl_hOriginalDll, "glTexCoord1iv"); + originalglTexCoord1s = GetProcAddress(gl_hOriginalDll, "glTexCoord1s"); + originalglTexCoord1sv = GetProcAddress(gl_hOriginalDll, "glTexCoord1sv"); + originalglTexCoord2d = GetProcAddress(gl_hOriginalDll, "glTexCoord2d"); + originalglTexCoord2dv = GetProcAddress(gl_hOriginalDll, "glTexCoord2dv"); + originalglTexCoord2f = GetProcAddress(gl_hOriginalDll, "glTexCoord2f"); + originalglTexCoord2fv = GetProcAddress(gl_hOriginalDll, "glTexCoord2fv"); + originalglTexCoord2i = GetProcAddress(gl_hOriginalDll, "glTexCoord2i"); + originalglTexCoord2iv = GetProcAddress(gl_hOriginalDll, "glTexCoord2iv"); + originalglTexCoord2s = GetProcAddress(gl_hOriginalDll, "glTexCoord2s"); + originalglTexCoord2sv = GetProcAddress(gl_hOriginalDll, "glTexCoord2sv"); + originalglTexCoord3d = GetProcAddress(gl_hOriginalDll, "glTexCoord3d"); + originalglTexCoord3dv = GetProcAddress(gl_hOriginalDll, "glTexCoord3dv"); + originalglTexCoord3f = GetProcAddress(gl_hOriginalDll, "glTexCoord3f"); + originalglTexCoord3fv = GetProcAddress(gl_hOriginalDll, "glTexCoord3fv"); + originalglTexCoord3i = GetProcAddress(gl_hOriginalDll, "glTexCoord3i"); + originalglTexCoord3iv = GetProcAddress(gl_hOriginalDll, "glTexCoord3iv"); + originalglTexCoord3s = GetProcAddress(gl_hOriginalDll, "glTexCoord3s"); + originalglTexCoord3sv = GetProcAddress(gl_hOriginalDll, "glTexCoord3sv"); + originalglTexCoord4d = GetProcAddress(gl_hOriginalDll, "glTexCoord4d"); + originalglTexCoord4dv = GetProcAddress(gl_hOriginalDll, "glTexCoord4dv"); + originalglTexCoord4f = GetProcAddress(gl_hOriginalDll, "glTexCoord4f"); + originalglTexCoord4fv = GetProcAddress(gl_hOriginalDll, "glTexCoord4fv"); + originalglTexCoord4i = GetProcAddress(gl_hOriginalDll, "glTexCoord4i"); + originalglTexCoord4iv = GetProcAddress(gl_hOriginalDll, "glTexCoord4iv"); + originalglTexCoord4s = GetProcAddress(gl_hOriginalDll, "glTexCoord4s"); + originalglTexCoord4sv = GetProcAddress(gl_hOriginalDll, "glTexCoord4sv"); + originalglVertex2d = GetProcAddress(gl_hOriginalDll, "glVertex2d"); + originalglVertex2dv = GetProcAddress(gl_hOriginalDll, "glVertex2dv"); + originalglVertex2f = GetProcAddress(gl_hOriginalDll, "glVertex2f"); + originalglVertex2fv = GetProcAddress(gl_hOriginalDll, "glVertex2fv"); + originalglVertex2i = GetProcAddress(gl_hOriginalDll, "glVertex2i"); + originalglVertex2iv = GetProcAddress(gl_hOriginalDll, "glVertex2iv"); + originalglVertex2s = GetProcAddress(gl_hOriginalDll, "glVertex2s"); + originalglVertex2sv = GetProcAddress(gl_hOriginalDll, "glVertex2sv"); + originalglVertex3d = GetProcAddress(gl_hOriginalDll, "glVertex3d"); + originalglVertex3dv = GetProcAddress(gl_hOriginalDll, "glVertex3dv"); + originalglVertex3f = GetProcAddress(gl_hOriginalDll, "glVertex3f"); + originalglVertex3fv = GetProcAddress(gl_hOriginalDll, "glVertex3fv"); + originalglVertex3i = GetProcAddress(gl_hOriginalDll, "glVertex3i"); + originalglVertex3iv = GetProcAddress(gl_hOriginalDll, "glVertex3iv"); + originalglVertex3s = GetProcAddress(gl_hOriginalDll, "glVertex3s"); + originalglVertex3sv = GetProcAddress(gl_hOriginalDll, "glVertex3sv"); + originalglVertex4d = GetProcAddress(gl_hOriginalDll, "glVertex4d"); + originalglVertex4dv = GetProcAddress(gl_hOriginalDll, "glVertex4dv"); + originalglVertex4f = GetProcAddress(gl_hOriginalDll, "glVertex4f"); + originalglVertex4fv = GetProcAddress(gl_hOriginalDll, "glVertex4fv"); + originalglVertex4i = GetProcAddress(gl_hOriginalDll, "glVertex4i"); + originalglVertex4iv = GetProcAddress(gl_hOriginalDll, "glVertex4iv"); + originalglVertex4s = GetProcAddress(gl_hOriginalDll, "glVertex4s"); + originalglVertex4sv = GetProcAddress(gl_hOriginalDll, "glVertex4sv"); + originalglMaterialf = GetProcAddress(gl_hOriginalDll, "glMaterialf"); + originalglMaterialfv = GetProcAddress(gl_hOriginalDll, "glMaterialfv"); + originalglMateriali = GetProcAddress(gl_hOriginalDll, "glMateriali"); + originalglMaterialiv = GetProcAddress(gl_hOriginalDll, "glMaterialiv"); + originalglDisable = GetProcAddress(gl_hOriginalDll, "glDisable"); + originalglEnable = GetProcAddress(gl_hOriginalDll, "glEnable"); + originalglPopAttrib = GetProcAddress(gl_hOriginalDll, "glPopAttrib"); + originalglPushAttrib = GetProcAddress(gl_hOriginalDll, "glPushAttrib"); + originalglEvalCoord1d = GetProcAddress(gl_hOriginalDll, "glEvalCoord1d"); + originalglEvalCoord1dv = GetProcAddress(gl_hOriginalDll, "glEvalCoord1dv"); + originalglEvalCoord1f = GetProcAddress(gl_hOriginalDll, "glEvalCoord1f"); + originalglEvalCoord1fv = GetProcAddress(gl_hOriginalDll, "glEvalCoord1fv"); + originalglEvalCoord2d = GetProcAddress(gl_hOriginalDll, "glEvalCoord2d"); + originalglEvalCoord2dv = GetProcAddress(gl_hOriginalDll, "glEvalCoord2dv"); + originalglEvalCoord2f = GetProcAddress(gl_hOriginalDll, "glEvalCoord2f"); + originalglEvalCoord2fv = GetProcAddress(gl_hOriginalDll, "glEvalCoord2fv"); + originalglEvalPoint1 = GetProcAddress(gl_hOriginalDll, "glEvalPoint1"); + originalglEvalPoint2 = GetProcAddress(gl_hOriginalDll, "glEvalPoint2"); + originalglLoadIdentity = GetProcAddress(gl_hOriginalDll, "glLoadIdentity"); + originalglLoadMatrixf = GetProcAddress(gl_hOriginalDll, "glLoadMatrixf"); + originalglLoadMatrixd = GetProcAddress(gl_hOriginalDll, "glLoadMatrixd"); + originalglMatrixMode = GetProcAddress(gl_hOriginalDll, "glMatrixMode"); + originalglMultMatrixf = GetProcAddress(gl_hOriginalDll, "glMultMatrixf"); + originalglMultMatrixd = GetProcAddress(gl_hOriginalDll, "glMultMatrixd"); + originalglPopMatrix = GetProcAddress(gl_hOriginalDll, "glPopMatrix"); + originalglPushMatrix = GetProcAddress(gl_hOriginalDll, "glPushMatrix"); + originalglRotated = GetProcAddress(gl_hOriginalDll, "glRotated"); + originalglRotatef = GetProcAddress(gl_hOriginalDll, "glRotatef"); + originalglScaled = GetProcAddress(gl_hOriginalDll, "glScaled"); + originalglScalef = GetProcAddress(gl_hOriginalDll, "glScalef"); + originalglTranslated = GetProcAddress(gl_hOriginalDll, "glTranslated"); + originalglTranslatef = GetProcAddress(gl_hOriginalDll, "glTranslatef"); + originalglArrayElement = GetProcAddress(gl_hOriginalDll, "glArrayElement"); + originalglBindTexture = GetProcAddress(gl_hOriginalDll, "glBindTexture"); + originalglColorPointer = GetProcAddress(gl_hOriginalDll, "glColorPointer"); + originalglDisableClientState = GetProcAddress(gl_hOriginalDll, "glDisableClientState"); + originalglDrawArrays = GetProcAddress(gl_hOriginalDll, "glDrawArrays"); + originalglDrawElements = GetProcAddress(gl_hOriginalDll, "glDrawElements"); + originalglEdgeFlagPointer = GetProcAddress(gl_hOriginalDll, "glEdgeFlagPointer"); + originalglEnableClientState = GetProcAddress(gl_hOriginalDll, "glEnableClientState"); + originalglIndexPointer = GetProcAddress(gl_hOriginalDll, "glIndexPointer"); + originalglIndexub = GetProcAddress(gl_hOriginalDll, "glIndexub"); + originalglIndexubv = GetProcAddress(gl_hOriginalDll, "glIndexubv"); + originalglInterleavedArrays = GetProcAddress(gl_hOriginalDll, "glInterleavedArrays"); + originalglNormalPointer = GetProcAddress(gl_hOriginalDll, "glNormalPointer"); + originalglPolygonOffset = GetProcAddress(gl_hOriginalDll, "glPolygonOffset"); + originalglTexCoordPointer = GetProcAddress(gl_hOriginalDll, "glTexCoordPointer"); + originalglVertexPointer = GetProcAddress(gl_hOriginalDll, "glVertexPointer"); + originalglGetPointerv = GetProcAddress(gl_hOriginalDll, "glGetPointerv"); + originalglPopClientAttrib = GetProcAddress(gl_hOriginalDll, "glPopClientAttrib"); + originalglPushClientAttrib = GetProcAddress(gl_hOriginalDll, "glPushClientAttrib"); + originalglClear = GetProcAddress(gl_hOriginalDll, "glClear"); + originalglClearAccum = GetProcAddress(gl_hOriginalDll, "glClearAccum"); + originalglClearIndex = GetProcAddress(gl_hOriginalDll, "glClearIndex"); + originalglClearColor = GetProcAddress(gl_hOriginalDll, "glClearColor"); + originalglClearStencil = GetProcAddress(gl_hOriginalDll, "glClearStencil"); + originalglClearDepth = GetProcAddress(gl_hOriginalDll, "glClearDepth"); + originalglBitmap = GetProcAddress(gl_hOriginalDll, "glBitmap"); + originalglTexImage1D = GetProcAddress(gl_hOriginalDll, "glTexImage1D"); + originalglTexImage2D = GetProcAddress(gl_hOriginalDll, "glTexImage2D"); + originalglCopyPixels = GetProcAddress(gl_hOriginalDll, "glCopyPixels"); + originalglReadPixels = GetProcAddress(gl_hOriginalDll, "glReadPixels"); + originalglDrawPixels = GetProcAddress(gl_hOriginalDll, "glDrawPixels"); + originalglRectd = GetProcAddress(gl_hOriginalDll, "glRectd"); + originalglRectdv = GetProcAddress(gl_hOriginalDll, "glRectdv"); + originalglRectf = GetProcAddress(gl_hOriginalDll, "glRectf"); + originalglRectfv = GetProcAddress(gl_hOriginalDll, "glRectfv"); + originalglRecti = GetProcAddress(gl_hOriginalDll, "glRecti"); + originalglRectiv = GetProcAddress(gl_hOriginalDll, "glRectiv"); + originalglRects = GetProcAddress(gl_hOriginalDll, "glRects"); + originalglRectsv = GetProcAddress(gl_hOriginalDll, "glRectsv"); + originalglNewList = GetProcAddress(gl_hOriginalDll, "glNewList"); + originalglEndList = GetProcAddress(gl_hOriginalDll, "glEndList"); + originalglDeleteLists = GetProcAddress(gl_hOriginalDll, "glDeleteLists"); + originalglGenLists = GetProcAddress(gl_hOriginalDll, "glGenLists"); + originalglListBase = GetProcAddress(gl_hOriginalDll, "glListBase"); + originalglRasterPos2d = GetProcAddress(gl_hOriginalDll, "glRasterPos2d"); + originalglRasterPos2dv = GetProcAddress(gl_hOriginalDll, "glRasterPos2dv"); + originalglRasterPos2f = GetProcAddress(gl_hOriginalDll, "glRasterPos2f"); + originalglRasterPos2fv = GetProcAddress(gl_hOriginalDll, "glRasterPos2fv"); + originalglRasterPos2i = GetProcAddress(gl_hOriginalDll, "glRasterPos2i"); + originalglRasterPos2iv = GetProcAddress(gl_hOriginalDll, "glRasterPos2iv"); + originalglRasterPos2s = GetProcAddress(gl_hOriginalDll, "glRasterPos2s"); + originalglRasterPos2sv = GetProcAddress(gl_hOriginalDll, "glRasterPos2sv"); + originalglRasterPos3d = GetProcAddress(gl_hOriginalDll, "glRasterPos3d"); + originalglRasterPos3dv = GetProcAddress(gl_hOriginalDll, "glRasterPos3dv"); + originalglRasterPos3f = GetProcAddress(gl_hOriginalDll, "glRasterPos3f"); + originalglRasterPos3fv = GetProcAddress(gl_hOriginalDll, "glRasterPos3fv"); + originalglRasterPos3i = GetProcAddress(gl_hOriginalDll, "glRasterPos3i"); + originalglRasterPos3iv = GetProcAddress(gl_hOriginalDll, "glRasterPos3iv"); + originalglRasterPos3s = GetProcAddress(gl_hOriginalDll, "glRasterPos3s"); + originalglRasterPos3sv = GetProcAddress(gl_hOriginalDll, "glRasterPos3sv"); + originalglRasterPos4d = GetProcAddress(gl_hOriginalDll, "glRasterPos4d"); + originalglRasterPos4dv = GetProcAddress(gl_hOriginalDll, "glRasterPos4dv"); + originalglRasterPos4f = GetProcAddress(gl_hOriginalDll, "glRasterPos4f"); + originalglRasterPos4fv = GetProcAddress(gl_hOriginalDll, "glRasterPos4fv"); + originalglRasterPos4i = GetProcAddress(gl_hOriginalDll, "glRasterPos4i"); + originalglRasterPos4iv = GetProcAddress(gl_hOriginalDll, "glRasterPos4iv"); + originalglRasterPos4s = GetProcAddress(gl_hOriginalDll, "glRasterPos4s"); + originalglRasterPos4sv = GetProcAddress(gl_hOriginalDll, "glRasterPos4sv"); + originalglClipPlane = GetProcAddress(gl_hOriginalDll, "glClipPlane"); + originalglColorMaterial = GetProcAddress(gl_hOriginalDll, "glColorMaterial"); + originalglCullFace = GetProcAddress(gl_hOriginalDll, "glCullFace"); + originalglFogf = GetProcAddress(gl_hOriginalDll, "glFogf"); + originalglFogfv = GetProcAddress(gl_hOriginalDll, "glFogfv"); + originalglFogi = GetProcAddress(gl_hOriginalDll, "glFogi"); + originalglFogiv = GetProcAddress(gl_hOriginalDll, "glFogiv"); + originalglFrontFace = GetProcAddress(gl_hOriginalDll, "glFrontFace"); + originalglHint = GetProcAddress(gl_hOriginalDll, "glHint"); + originalglLightf = GetProcAddress(gl_hOriginalDll, "glLightf"); + originalglLightfv = GetProcAddress(gl_hOriginalDll, "glLightfv"); + originalglLighti = GetProcAddress(gl_hOriginalDll, "glLighti"); + originalglLightiv = GetProcAddress(gl_hOriginalDll, "glLightiv"); + originalglLightModelf = GetProcAddress(gl_hOriginalDll, "glLightModelf"); + originalglLightModelfv = GetProcAddress(gl_hOriginalDll, "glLightModelfv"); + originalglLightModeli = GetProcAddress(gl_hOriginalDll, "glLightModeli"); + originalglLightModeliv = GetProcAddress(gl_hOriginalDll, "glLightModeliv"); + originalglLineStipple = GetProcAddress(gl_hOriginalDll, "glLineStipple"); + originalglLineWidth = GetProcAddress(gl_hOriginalDll, "glLineWidth"); + originalglPointSize = GetProcAddress(gl_hOriginalDll, "glPointSize"); + originalglPolygonMode = GetProcAddress(gl_hOriginalDll, "glPolygonMode"); + originalglPolygonStipple = GetProcAddress(gl_hOriginalDll, "glPolygonStipple"); + originalglScissor = GetProcAddress(gl_hOriginalDll, "glScissor"); + originalglFinish = GetProcAddress(gl_hOriginalDll, "glFinish"); + originalglShadeModel = GetProcAddress(gl_hOriginalDll, "glShadeModel"); + originalglTexParameterf = GetProcAddress(gl_hOriginalDll, "glTexParameterf"); + originalglTexParameterfv = GetProcAddress(gl_hOriginalDll, "glTexParameterfv"); + originalglTexParameteri = GetProcAddress(gl_hOriginalDll, "glTexParameteri"); + originalglTexParameteriv = GetProcAddress(gl_hOriginalDll, "glTexParameteriv"); + originalglTexEnvf = GetProcAddress(gl_hOriginalDll, "glTexEnvf"); + originalglTexEnvfv = GetProcAddress(gl_hOriginalDll, "glTexEnvfv"); + originalglTexEnvi = GetProcAddress(gl_hOriginalDll, "glTexEnvi"); + originalglTexEnviv = GetProcAddress(gl_hOriginalDll, "glTexEnviv"); + originalglTexGend = GetProcAddress(gl_hOriginalDll, "glTexGend"); + originalglTexGendv = GetProcAddress(gl_hOriginalDll, "glTexGendv"); + originalglTexGenf = GetProcAddress(gl_hOriginalDll, "glTexGenf"); + originalglTexGenfv = GetProcAddress(gl_hOriginalDll, "glTexGenfv"); + originalglTexGeni = GetProcAddress(gl_hOriginalDll, "glTexGeni"); + originalglTexGeniv = GetProcAddress(gl_hOriginalDll, "glTexGeniv"); + originalglFeedbackBuffer = GetProcAddress(gl_hOriginalDll, "glFeedbackBuffer"); + originalglSelectBuffer = GetProcAddress(gl_hOriginalDll, "glSelectBuffer"); + originalglRenderMode = GetProcAddress(gl_hOriginalDll, "glRenderMode"); + originalglInitNames = GetProcAddress(gl_hOriginalDll, "glInitNames"); + originalglLoadName = GetProcAddress(gl_hOriginalDll, "glLoadName"); + originalglPassThrough = GetProcAddress(gl_hOriginalDll, "glPassThrough"); + originalglPopName = GetProcAddress(gl_hOriginalDll, "glPopName"); + originalglPushName = GetProcAddress(gl_hOriginalDll, "glPushName"); + originalglDrawBuffer = GetProcAddress(gl_hOriginalDll, "glDrawBuffer"); + originalglStencilMask = GetProcAddress(gl_hOriginalDll, "glStencilMask"); + originalglColorMask = GetProcAddress(gl_hOriginalDll, "glColorMask"); + originalglDepthMask = GetProcAddress(gl_hOriginalDll, "glDepthMask"); + originalglIndexMask = GetProcAddress(gl_hOriginalDll, "glIndexMask"); + originalglAccum = GetProcAddress(gl_hOriginalDll, "glAccum"); + originalglFlush = GetProcAddress(gl_hOriginalDll, "glFlush"); + originalglMap1d = GetProcAddress(gl_hOriginalDll, "glMap1d"); + originalglMap1f = GetProcAddress(gl_hOriginalDll, "glMap1f"); + originalglMap2d = GetProcAddress(gl_hOriginalDll, "glMap2d"); + originalglMap2f = GetProcAddress(gl_hOriginalDll, "glMap2f"); + originalglMapGrid1d = GetProcAddress(gl_hOriginalDll, "glMapGrid1d"); + originalglMapGrid1f = GetProcAddress(gl_hOriginalDll, "glMapGrid1f"); + originalglMapGrid2d = GetProcAddress(gl_hOriginalDll, "glMapGrid2d"); + originalglMapGrid2f = GetProcAddress(gl_hOriginalDll, "glMapGrid2f"); + originalglEvalMesh1 = GetProcAddress(gl_hOriginalDll, "glEvalMesh1"); + originalglEvalMesh2 = GetProcAddress(gl_hOriginalDll, "glEvalMesh2"); + originalglAlphaFunc = GetProcAddress(gl_hOriginalDll, "glAlphaFunc"); + originalglBlendFunc = GetProcAddress(gl_hOriginalDll, "glBlendFunc"); + originalglLogicOp = GetProcAddress(gl_hOriginalDll, "glLogicOp"); + originalglStencilFunc = GetProcAddress(gl_hOriginalDll, "glStencilFunc"); + originalglStencilOp = GetProcAddress(gl_hOriginalDll, "glStencilOp"); + originalglDepthFunc = GetProcAddress(gl_hOriginalDll, "glDepthFunc"); + originalglPixelZoom = GetProcAddress(gl_hOriginalDll, "glPixelZoom"); + originalglPixelTransferf = GetProcAddress(gl_hOriginalDll, "glPixelTransferf"); + originalglPixelTransferi = GetProcAddress(gl_hOriginalDll, "glPixelTransferi"); + originalglPixelStoref = GetProcAddress(gl_hOriginalDll, "glPixelStoref"); + originalglPixelStorei = GetProcAddress(gl_hOriginalDll, "glPixelStorei"); + originalglPixelMapfv = GetProcAddress(gl_hOriginalDll, "glPixelMapfv"); + originalglPixelMapuiv = GetProcAddress(gl_hOriginalDll, "glPixelMapuiv"); + originalglPixelMapusv = GetProcAddress(gl_hOriginalDll, "glPixelMapusv"); + originalglReadBuffer = GetProcAddress(gl_hOriginalDll, "glReadBuffer"); + originalglGetBooleanv = GetProcAddress(gl_hOriginalDll, "glGetBooleanv"); + originalglGetClipPlane = GetProcAddress(gl_hOriginalDll, "glGetClipPlane"); + originalglGetDoublev = GetProcAddress(gl_hOriginalDll, "glGetDoublev"); + originalglGetError = GetProcAddress(gl_hOriginalDll, "glGetError"); + originalglGetFloatv = GetProcAddress(gl_hOriginalDll, "glGetFloatv"); + originalglGetIntegerv = GetProcAddress(gl_hOriginalDll, "glGetIntegerv"); + originalglGetLightfv = GetProcAddress(gl_hOriginalDll, "glGetLightfv"); + originalglGetLightiv = GetProcAddress(gl_hOriginalDll, "glGetLightiv"); + originalglGetMapdv = GetProcAddress(gl_hOriginalDll, "glGetMapdv"); + originalglGetMapfv = GetProcAddress(gl_hOriginalDll, "glGetMapfv"); + originalglGetMapiv = GetProcAddress(gl_hOriginalDll, "glGetMapiv"); + originalglGetMaterialfv = GetProcAddress(gl_hOriginalDll, "glGetMaterialfv"); + originalglGetMaterialiv = GetProcAddress(gl_hOriginalDll, "glGetMaterialiv"); + originalglGetPixelMapfv = GetProcAddress(gl_hOriginalDll, "glGetPixelMapfv"); + originalglGetPixelMapuiv = GetProcAddress(gl_hOriginalDll, "glGetPixelMapuiv"); + originalglGetPixelMapusv = GetProcAddress(gl_hOriginalDll, "glGetPixelMapusv"); + originalglGetPolygonStipple = GetProcAddress(gl_hOriginalDll, "glGetPolygonStipple"); + originalglGetString = GetProcAddress(gl_hOriginalDll, "glGetString"); + originalglGetTexEnvfv = GetProcAddress(gl_hOriginalDll, "glGetTexEnvfv"); + originalglGetTexEnviv = GetProcAddress(gl_hOriginalDll, "glGetTexEnviv"); + originalglGetTexGendv = GetProcAddress(gl_hOriginalDll, "glGetTexGendv"); + originalglGetTexGenfv = GetProcAddress(gl_hOriginalDll, "glGetTexGenfv"); + originalglGetTexGeniv = GetProcAddress(gl_hOriginalDll, "glGetTexGeniv"); + originalglGetTexImage = GetProcAddress(gl_hOriginalDll, "glGetTexImage"); + originalglGetTexParameterfv = GetProcAddress(gl_hOriginalDll, "glGetTexParameterfv"); + originalglGetTexParameteriv = GetProcAddress(gl_hOriginalDll, "glGetTexParameteriv"); + originalglGetTexLevelParameterfv = GetProcAddress(gl_hOriginalDll, "glGetTexLevelParameterfv"); + originalglGetTexLevelParameteriv = GetProcAddress(gl_hOriginalDll, "glGetTexLevelParameteriv"); + originalglIsEnabled = GetProcAddress(gl_hOriginalDll, "glIsEnabled"); + originalglIsList = GetProcAddress(gl_hOriginalDll, "glIsList"); + originalglDepthRange = GetProcAddress(gl_hOriginalDll, "glDepthRange"); + originalglFrustum = GetProcAddress(gl_hOriginalDll, "glFrustum"); + originalglOrtho = GetProcAddress(gl_hOriginalDll, "glOrtho"); + originalglViewport = GetProcAddress(gl_hOriginalDll, "glViewport"); + originalglAreTexturesResident = GetProcAddress(gl_hOriginalDll, "glAreTexturesResident"); + originalglCopyTexImage1D = GetProcAddress(gl_hOriginalDll, "glCopyTexImage1D"); + originalglCopyTexImage2D = GetProcAddress(gl_hOriginalDll, "glCopyTexImage2D"); + originalglCopyTexSubImage1D = GetProcAddress(gl_hOriginalDll, "glCopyTexSubImage1D"); + originalglCopyTexSubImage2D = GetProcAddress(gl_hOriginalDll, "glCopyTexSubImage2D"); + originalglDeleteTextures = GetProcAddress(gl_hOriginalDll, "glDeleteTextures"); + originalglGenTextures = GetProcAddress(gl_hOriginalDll, "glGenTextures"); + originalglIsTexture = GetProcAddress(gl_hOriginalDll, "glIsTexture"); + originalglPrioritizeTextures = GetProcAddress(gl_hOriginalDll, "glPrioritizeTextures"); + originalglTexSubImage1D = GetProcAddress(gl_hOriginalDll, "glTexSubImage1D"); + originalglTexSubImage2D = GetProcAddress(gl_hOriginalDll, "glTexSubImage2D"); +} + +if (currentLibrary == lib::winmm) +{ + originalPlaySoundW = GetProcAddress(gl_hOriginalDll, "PlaySoundW"); + originaltimeSetEvent = GetProcAddress(gl_hOriginalDll, "timeSetEvent"); + originaltimeKillEvent = GetProcAddress(gl_hOriginalDll, "timeKillEvent"); + originalmidiOutMessage = GetProcAddress(gl_hOriginalDll, "midiOutMessage"); + originaltimeBeginPeriod = GetProcAddress(gl_hOriginalDll, "timeBeginPeriod"); + originaltimeGetTime = GetProcAddress(gl_hOriginalDll, "timeGetTime"); + originalNotifyCallbackData = GetProcAddress(gl_hOriginalDll, "NotifyCallbackData"); + originalWOW32DriverCallback = GetProcAddress(gl_hOriginalDll, "WOW32DriverCallback"); + originalWOW32ResolveMultiMediaHandle = GetProcAddress(gl_hOriginalDll, "WOW32ResolveMultiMediaHandle"); + originalaux32Message = GetProcAddress(gl_hOriginalDll, "aux32Message"); + originaljoy32Message = GetProcAddress(gl_hOriginalDll, "joy32Message"); + originalmid32Message = GetProcAddress(gl_hOriginalDll, "mid32Message"); + originalmod32Message = GetProcAddress(gl_hOriginalDll, "mod32Message"); + originalmxd32Message = GetProcAddress(gl_hOriginalDll, "mxd32Message"); + originaltid32Message = GetProcAddress(gl_hOriginalDll, "tid32Message"); + originalwid32Message = GetProcAddress(gl_hOriginalDll, "wid32Message"); + originalwod32Message = GetProcAddress(gl_hOriginalDll, "wod32Message"); + originalmci32Message = GetProcAddress(gl_hOriginalDll, "mci32Message"); + originalCloseDriver = GetProcAddress(gl_hOriginalDll, "CloseDriver"); + originalDefDriverProc = GetProcAddress(gl_hOriginalDll, "DefDriverProc"); + originalDriverCallback = GetProcAddress(gl_hOriginalDll, "DriverCallback"); + originalDrvGetModuleHandle = GetProcAddress(gl_hOriginalDll, "DrvGetModuleHandle"); + originalGetDriverModuleHandle = GetProcAddress(gl_hOriginalDll, "GetDriverModuleHandle"); + originalOpenDriver = GetProcAddress(gl_hOriginalDll, "OpenDriver"); + originalPlaySound = GetProcAddress(gl_hOriginalDll, "PlaySound"); + originalOrdinal2 = GetProcAddress(gl_hOriginalDll, "Ordinal2"); + originalSendDriverMessage = GetProcAddress(gl_hOriginalDll, "SendDriverMessage"); + originalauxGetDevCapsA = GetProcAddress(gl_hOriginalDll, "auxGetDevCapsA"); + originalauxGetDevCapsW = GetProcAddress(gl_hOriginalDll, "auxGetDevCapsW"); + originalauxGetNumDevs = GetProcAddress(gl_hOriginalDll, "auxGetNumDevs"); + originalauxGetVolume = GetProcAddress(gl_hOriginalDll, "auxGetVolume"); + originalauxOutMessage = GetProcAddress(gl_hOriginalDll, "auxOutMessage"); + originalauxSetVolume = GetProcAddress(gl_hOriginalDll, "auxSetVolume"); + originaljoyConfigChanged = GetProcAddress(gl_hOriginalDll, "joyConfigChanged"); + originaljoyGetDevCapsA = GetProcAddress(gl_hOriginalDll, "joyGetDevCapsA"); + originaljoyGetDevCapsW = GetProcAddress(gl_hOriginalDll, "joyGetDevCapsW"); + originaljoyGetNumDevs = GetProcAddress(gl_hOriginalDll, "joyGetNumDevs"); + originaljoyGetPosEx = GetProcAddress(gl_hOriginalDll, "joyGetPosEx"); + originaljoyGetPos = GetProcAddress(gl_hOriginalDll, "joyGetPos"); + originaljoyGetThreshold = GetProcAddress(gl_hOriginalDll, "joyGetThreshold"); + originaljoyReleaseCapture = GetProcAddress(gl_hOriginalDll, "joyReleaseCapture"); + originaljoySetCapture = GetProcAddress(gl_hOriginalDll, "joySetCapture"); + originaljoySetThreshold = GetProcAddress(gl_hOriginalDll, "joySetThreshold"); + originalmidiConnect = GetProcAddress(gl_hOriginalDll, "midiConnect"); + originalmidiDisconnect = GetProcAddress(gl_hOriginalDll, "midiDisconnect"); + originalmidiInAddBuffer = GetProcAddress(gl_hOriginalDll, "midiInAddBuffer"); + originalmidiInClose = GetProcAddress(gl_hOriginalDll, "midiInClose"); + originalmidiInGetDevCapsA = GetProcAddress(gl_hOriginalDll, "midiInGetDevCapsA"); + originalmidiInGetDevCapsW = GetProcAddress(gl_hOriginalDll, "midiInGetDevCapsW"); + originalmidiInGetErrorTextA = GetProcAddress(gl_hOriginalDll, "midiInGetErrorTextA"); + originalmidiInGetErrorTextW = GetProcAddress(gl_hOriginalDll, "midiInGetErrorTextW"); + originalmidiInGetID = GetProcAddress(gl_hOriginalDll, "midiInGetID"); + originalmidiInGetNumDevs = GetProcAddress(gl_hOriginalDll, "midiInGetNumDevs"); + originalmidiInMessage = GetProcAddress(gl_hOriginalDll, "midiInMessage"); + originalmidiInOpen = GetProcAddress(gl_hOriginalDll, "midiInOpen"); + originalmidiInPrepareHeader = GetProcAddress(gl_hOriginalDll, "midiInPrepareHeader"); + originalmidiInReset = GetProcAddress(gl_hOriginalDll, "midiInReset"); + originalmidiInStart = GetProcAddress(gl_hOriginalDll, "midiInStart"); + originalmidiInStop = GetProcAddress(gl_hOriginalDll, "midiInStop"); + originalmidiInUnprepareHeader = GetProcAddress(gl_hOriginalDll, "midiInUnprepareHeader"); + originalmidiOutCacheDrumPatches = GetProcAddress(gl_hOriginalDll, "midiOutCacheDrumPatches"); + originalmidiOutCachePatches = GetProcAddress(gl_hOriginalDll, "midiOutCachePatches"); + originalmidiOutClose = GetProcAddress(gl_hOriginalDll, "midiOutClose"); + originalmidiOutGetDevCapsA = GetProcAddress(gl_hOriginalDll, "midiOutGetDevCapsA"); + originalmidiOutGetDevCapsW = GetProcAddress(gl_hOriginalDll, "midiOutGetDevCapsW"); + originalmidiOutGetErrorTextA = GetProcAddress(gl_hOriginalDll, "midiOutGetErrorTextA"); + originalmidiOutGetErrorTextW = GetProcAddress(gl_hOriginalDll, "midiOutGetErrorTextW"); + originalmidiOutGetID = GetProcAddress(gl_hOriginalDll, "midiOutGetID"); + originalmidiOutGetNumDevs = GetProcAddress(gl_hOriginalDll, "midiOutGetNumDevs"); + originalmidiOutGetVolume = GetProcAddress(gl_hOriginalDll, "midiOutGetVolume"); + originalmidiOutLongMsg = GetProcAddress(gl_hOriginalDll, "midiOutLongMsg"); + originalmidiOutOpen = GetProcAddress(gl_hOriginalDll, "midiOutOpen"); + originalmidiOutPrepareHeader = GetProcAddress(gl_hOriginalDll, "midiOutPrepareHeader"); + originalmidiOutReset = GetProcAddress(gl_hOriginalDll, "midiOutReset"); + originalmidiOutSetVolume = GetProcAddress(gl_hOriginalDll, "midiOutSetVolume"); + originalmidiOutShortMsg = GetProcAddress(gl_hOriginalDll, "midiOutShortMsg"); + originalmidiOutUnprepareHeader = GetProcAddress(gl_hOriginalDll, "midiOutUnprepareHeader"); + originalmidiStreamClose = GetProcAddress(gl_hOriginalDll, "midiStreamClose"); + originalmidiStreamOpen = GetProcAddress(gl_hOriginalDll, "midiStreamOpen"); + originalmidiStreamOut = GetProcAddress(gl_hOriginalDll, "midiStreamOut"); + originalmidiStreamPause = GetProcAddress(gl_hOriginalDll, "midiStreamPause"); + originalmidiStreamPosition = GetProcAddress(gl_hOriginalDll, "midiStreamPosition"); + originalmidiStreamProperty = GetProcAddress(gl_hOriginalDll, "midiStreamProperty"); + originalmidiStreamRestart = GetProcAddress(gl_hOriginalDll, "midiStreamRestart"); + originalmidiStreamStop = GetProcAddress(gl_hOriginalDll, "midiStreamStop"); + originalmixerClose = GetProcAddress(gl_hOriginalDll, "mixerClose"); + originalmixerGetControlDetailsA = GetProcAddress(gl_hOriginalDll, "mixerGetControlDetailsA"); + originalmixerGetControlDetailsW = GetProcAddress(gl_hOriginalDll, "mixerGetControlDetailsW"); + originalmixerGetDevCapsA = GetProcAddress(gl_hOriginalDll, "mixerGetDevCapsA"); + originalmixerGetDevCapsW = GetProcAddress(gl_hOriginalDll, "mixerGetDevCapsW"); + originalmixerGetID = GetProcAddress(gl_hOriginalDll, "mixerGetID"); + originalmixerGetLineControlsA = GetProcAddress(gl_hOriginalDll, "mixerGetLineControlsA"); + originalmixerGetLineControlsW = GetProcAddress(gl_hOriginalDll, "mixerGetLineControlsW"); + originalmixerGetLineInfoA = GetProcAddress(gl_hOriginalDll, "mixerGetLineInfoA"); + originalmixerGetLineInfoW = GetProcAddress(gl_hOriginalDll, "mixerGetLineInfoW"); + originalmixerGetNumDevs = GetProcAddress(gl_hOriginalDll, "mixerGetNumDevs"); + originalmixerMessage = GetProcAddress(gl_hOriginalDll, "mixerMessage"); + originalmixerOpen = GetProcAddress(gl_hOriginalDll, "mixerOpen"); + originalmixerSetControlDetails = GetProcAddress(gl_hOriginalDll, "mixerSetControlDetails"); + originalmmDrvInstall = GetProcAddress(gl_hOriginalDll, "mmDrvInstall"); + originalmmGetCurrentTask = GetProcAddress(gl_hOriginalDll, "mmGetCurrentTask"); + originalmmTaskBlock = GetProcAddress(gl_hOriginalDll, "mmTaskBlock"); + originalmmTaskCreate = GetProcAddress(gl_hOriginalDll, "mmTaskCreate"); + originalmmTaskSignal = GetProcAddress(gl_hOriginalDll, "mmTaskSignal"); + originalmmTaskYield = GetProcAddress(gl_hOriginalDll, "mmTaskYield"); + originalmmioAdvance = GetProcAddress(gl_hOriginalDll, "mmioAdvance"); + originalmmioAscend = GetProcAddress(gl_hOriginalDll, "mmioAscend"); + originalmmioClose = GetProcAddress(gl_hOriginalDll, "mmioClose"); + originalmmioCreateChunk = GetProcAddress(gl_hOriginalDll, "mmioCreateChunk"); + originalmmioDescend = GetProcAddress(gl_hOriginalDll, "mmioDescend"); + originalmmioFlush = GetProcAddress(gl_hOriginalDll, "mmioFlush"); + originalmmioGetInfo = GetProcAddress(gl_hOriginalDll, "mmioGetInfo"); + originalmmioInstallIOProcA = GetProcAddress(gl_hOriginalDll, "mmioInstallIOProcA"); + originalmmioInstallIOProcW = GetProcAddress(gl_hOriginalDll, "mmioInstallIOProcW"); + originalmmioOpenA = GetProcAddress(gl_hOriginalDll, "mmioOpenA"); + originalmmioOpenW = GetProcAddress(gl_hOriginalDll, "mmioOpenW"); + originalmmioRead = GetProcAddress(gl_hOriginalDll, "mmioRead"); + originalmmioRenameA = GetProcAddress(gl_hOriginalDll, "mmioRenameA"); + originalmmioRenameW = GetProcAddress(gl_hOriginalDll, "mmioRenameW"); + originalmmioSeek = GetProcAddress(gl_hOriginalDll, "mmioSeek"); + originalmmioSendMessage = GetProcAddress(gl_hOriginalDll, "mmioSendMessage"); + originalmmioSetBuffer = GetProcAddress(gl_hOriginalDll, "mmioSetBuffer"); + originalmmioSetInfo = GetProcAddress(gl_hOriginalDll, "mmioSetInfo"); + originalmmioStringToFOURCCA = GetProcAddress(gl_hOriginalDll, "mmioStringToFOURCCA"); + originalmmioStringToFOURCCW = GetProcAddress(gl_hOriginalDll, "mmioStringToFOURCCW"); + originalmmioWrite = GetProcAddress(gl_hOriginalDll, "mmioWrite"); + originaltimeEndPeriod = GetProcAddress(gl_hOriginalDll, "timeEndPeriod"); + originaltimeGetDevCaps = GetProcAddress(gl_hOriginalDll, "timeGetDevCaps"); + originaltimeGetSystemTime = GetProcAddress(gl_hOriginalDll, "timeGetSystemTime"); + originalwaveInAddBuffer = GetProcAddress(gl_hOriginalDll, "waveInAddBuffer"); + originalwaveInClose = GetProcAddress(gl_hOriginalDll, "waveInClose"); + originalwaveInGetDevCapsA = GetProcAddress(gl_hOriginalDll, "waveInGetDevCapsA"); + originalwaveInGetDevCapsW = GetProcAddress(gl_hOriginalDll, "waveInGetDevCapsW"); + originalwaveInGetErrorTextA = GetProcAddress(gl_hOriginalDll, "waveInGetErrorTextA"); + originalwaveInGetErrorTextW = GetProcAddress(gl_hOriginalDll, "waveInGetErrorTextW"); + originalwaveInGetID = GetProcAddress(gl_hOriginalDll, "waveInGetID"); + originalwaveInGetNumDevs = GetProcAddress(gl_hOriginalDll, "waveInGetNumDevs"); + originalwaveInGetPosition = GetProcAddress(gl_hOriginalDll, "waveInGetPosition"); + originalwaveInMessage = GetProcAddress(gl_hOriginalDll, "waveInMessage"); + originalwaveInOpen = GetProcAddress(gl_hOriginalDll, "waveInOpen"); + originalwaveInPrepareHeader = GetProcAddress(gl_hOriginalDll, "waveInPrepareHeader"); + originalwaveInReset = GetProcAddress(gl_hOriginalDll, "waveInReset"); + originalwaveInStart = GetProcAddress(gl_hOriginalDll, "waveInStart"); + originalwaveInStop = GetProcAddress(gl_hOriginalDll, "waveInStop"); + originalwaveInUnprepareHeader = GetProcAddress(gl_hOriginalDll, "waveInUnprepareHeader"); + originalwaveOutBreakLoop = GetProcAddress(gl_hOriginalDll, "waveOutBreakLoop"); + originalwaveOutClose = GetProcAddress(gl_hOriginalDll, "waveOutClose"); + originalwaveOutGetDevCapsA = GetProcAddress(gl_hOriginalDll, "waveOutGetDevCapsA"); + originalwaveOutGetDevCapsW = GetProcAddress(gl_hOriginalDll, "waveOutGetDevCapsW"); + originalwaveOutGetErrorTextA = GetProcAddress(gl_hOriginalDll, "waveOutGetErrorTextA"); + originalwaveOutGetErrorTextW = GetProcAddress(gl_hOriginalDll, "waveOutGetErrorTextW"); + originalwaveOutGetID = GetProcAddress(gl_hOriginalDll, "waveOutGetID"); + originalwaveOutGetNumDevs = GetProcAddress(gl_hOriginalDll, "waveOutGetNumDevs"); + originalwaveOutGetPitch = GetProcAddress(gl_hOriginalDll, "waveOutGetPitch"); + originalwaveOutGetPlaybackRate = GetProcAddress(gl_hOriginalDll, "waveOutGetPlaybackRate"); + originalwaveOutGetPosition = GetProcAddress(gl_hOriginalDll, "waveOutGetPosition"); + originalwaveOutGetVolume = GetProcAddress(gl_hOriginalDll, "waveOutGetVolume"); + originalwaveOutMessage = GetProcAddress(gl_hOriginalDll, "waveOutMessage"); + originalwaveOutOpen = GetProcAddress(gl_hOriginalDll, "waveOutOpen"); + originalwaveOutPause = GetProcAddress(gl_hOriginalDll, "waveOutPause"); + originalwaveOutPrepareHeader = GetProcAddress(gl_hOriginalDll, "waveOutPrepareHeader"); + originalwaveOutReset = GetProcAddress(gl_hOriginalDll, "waveOutReset"); + originalwaveOutRestart = GetProcAddress(gl_hOriginalDll, "waveOutRestart"); + originalwaveOutSetPitch = GetProcAddress(gl_hOriginalDll, "waveOutSetPitch"); + originalwaveOutSetPlaybackRate = GetProcAddress(gl_hOriginalDll, "waveOutSetPlaybackRate"); + originalwaveOutSetVolume = GetProcAddress(gl_hOriginalDll, "waveOutSetVolume"); + originalwaveOutUnprepareHeader = GetProcAddress(gl_hOriginalDll, "waveOutUnprepareHeader"); + originalwaveOutWrite = GetProcAddress(gl_hOriginalDll, "waveOutWrite"); + originalmciExecute = GetProcAddress(gl_hOriginalDll, "mciExecute"); + originalmciGetErrorStringA = GetProcAddress(gl_hOriginalDll, "mciGetErrorStringA"); + originalmciGetErrorStringW = GetProcAddress(gl_hOriginalDll, "mciGetErrorStringW"); + originalmciSendCommandA = GetProcAddress(gl_hOriginalDll, "mciSendCommandA"); + originalmciSendCommandW = GetProcAddress(gl_hOriginalDll, "mciSendCommandW"); + originalmciSendStringA = GetProcAddress(gl_hOriginalDll, "mciSendStringA"); + originalmciSendStringW = GetProcAddress(gl_hOriginalDll, "mciSendStringW"); + originalmciFreeCommandResource = GetProcAddress(gl_hOriginalDll, "mciFreeCommandResource"); + originalmciLoadCommandResource = GetProcAddress(gl_hOriginalDll, "mciLoadCommandResource"); + originalmciDriverNotify = GetProcAddress(gl_hOriginalDll, "mciDriverNotify"); + originalmciDriverYield = GetProcAddress(gl_hOriginalDll, "mciDriverYield"); + originalmciGetCreatorTask = GetProcAddress(gl_hOriginalDll, "mciGetCreatorTask"); + originalmciGetDeviceIDA = GetProcAddress(gl_hOriginalDll, "mciGetDeviceIDA"); + originalmciGetDeviceIDFromElementIDA = GetProcAddress(gl_hOriginalDll, "mciGetDeviceIDFromElementIDA"); + originalmciGetDeviceIDFromElementIDW = GetProcAddress(gl_hOriginalDll, "mciGetDeviceIDFromElementIDW"); + originalmciGetDeviceIDW = GetProcAddress(gl_hOriginalDll, "mciGetDeviceIDW"); + originalmciGetDriverData = GetProcAddress(gl_hOriginalDll, "mciGetDriverData"); + originalmciGetYieldProc = GetProcAddress(gl_hOriginalDll, "mciGetYieldProc"); + originalmciSetDriverData = GetProcAddress(gl_hOriginalDll, "mciSetDriverData"); + originalmciSetYieldProc = GetProcAddress(gl_hOriginalDll, "mciSetYieldProc"); + originalPlaySoundA = GetProcAddress(gl_hOriginalDll, "PlaySoundA"); + originalsndPlaySoundA = GetProcAddress(gl_hOriginalDll, "sndPlaySoundA"); + originalsndPlaySoundW = GetProcAddress(gl_hOriginalDll, "sndPlaySoundW"); + originalWOWAppExit = GetProcAddress(gl_hOriginalDll, "WOWAppExit"); + originalmmsystemGetVersion = GetProcAddress(gl_hOriginalDll, "mmsystemGetVersion"); +} + + hlp.log("creating ffb loop thread..."); + CreateFFBLoopThread(); + if (BeepWhenHook == 1) + { + MessageBeep(MB_ICONASTERISK); + } + break; + + case DLL_THREAD_ATTACH: + hlp.log("dll thread attach"); + break; + + case DLL_THREAD_DETACH: + hlp.log("dll thread detach"); + break; + + case DLL_PROCESS_DETACH: + hlp.log("detaching from process:"); + hlp.log((char *)processName.c_str()); + keepRunning = false; + if (gl_hOriginalDll) + { + FreeLibrary(gl_hOriginalDll); + } + if (gl_hjgtDll) + { + FreeLibrary(gl_hjgtDll); + } + if (gl_hlibavs) + { + FreeLibrary(gl_hlibavs); + } + + // this doesn't seem to really work...hmm...if i ALT+F4, then the program quits and haptic is still set. + // try setting GameId to HEAVY (-5 or -6..can't remember) and then force quit. Wheel will stay heavy :/. + if (haptic) { + SDL_HapticStopEffect(haptic, effects.effect_left_id); + SDL_HapticStopEffect(haptic, effects.effect_right_id); + SDL_HapticStopEffect(haptic, effects.effect_friction_id); + SDL_HapticStopEffect(haptic, effects.effect_leftright_id); + SDL_HapticStopEffect(haptic, effects.effect_sine_id); + SDL_HapticStopEffect(haptic, effects.effect_spring_id); + SDL_HapticStopEffect(haptic, effects.effect_vibration_id); + SDL_HapticStopAll(haptic); + SDL_HapticClose(haptic); // release the haptic device / clean-up. + } + break; + } + + return result; +} \ No newline at end of file diff --git a/Game Files/AfterburnerClimax.cpp b/Game Files/AfterburnerClimax.cpp new file mode 100644 index 0000000..38a43b5 --- /dev/null +++ b/Game Files/AfterburnerClimax.cpp @@ -0,0 +1,27 @@ +#include +#include "AfterburnerClimax.h" +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()); + + 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); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (ff == 80) + { + double percentForce = ((Rumble2Strength) / 100.0); + double percentLength = (Rumble2Length); + triggers->LeftRight(percentForce, percentForce, percentLength); + } +} \ No newline at end of file diff --git a/Game Files/AfterburnerClimax.h b/Game Files/AfterburnerClimax.h new file mode 100644 index 0000000..b896b1d --- /dev/null +++ b/Game Files/AfterburnerClimax.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class AfterburnerClimax : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/BG4JP.cpp b/Game Files/BG4JP.cpp new file mode 100644 index 0000000..67c1edb --- /dev/null +++ b/Game Files/BG4JP.cpp @@ -0,0 +1,155 @@ +#include +#include "BG4JP.h" + +void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + int ff = helpers->ReadInt32(0x42EBB0, /* isRelativeOffset */ true); + float ffspeed = helpers->ReadFloat32(0x3F3000, /* isRelativeOffset */ true); + float ff2 = helpers->ReadFloat32(0x42EAB4, /* isRelativeOffset */ true); + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + + if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 0.1) & (ffspeed <= 15)) + { + double percentForce = (0.1); + double percentLength = (200); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 0.1) & (ffspeed <= 15)) + { + double percentForce = (0.1); + double percentLength = (200); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 15.01) & (ffspeed <= 35)) + { + double percentForce = (0.2); + double percentLength = (200); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 15.01) & (ffspeed <= 35)) + { + double percentForce = (0.2); + double percentLength = (200); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + triggers->Rumble(percentForce, percentLength); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 35.01) & (ffspeed <= 55)) + { + double percentForce = (0.3); + double percentLength = (250); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 35.01) & (ffspeed <= 55)) + { + double percentForce = (0.3); + double percentLength = (250); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + triggers->Rumble(percentForce, percentLength); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 55.01) & (ffspeed <= 75)) + { + double percentForce = (0.4); + double percentLength = (280); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + triggers->Rumble(percentForce, percentLength); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 55.01) & (ffspeed <= 75)) + { + double percentForce = (0.4); + double percentLength = (280); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 75.01) & (ffspeed <= 90)) + { + double percentForce = (0.5); + double percentLength = (320); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 75.01) & (ffspeed <= 90)) + { + double percentForce = (0.5); + double percentLength = (320); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 90.01) & (ffspeed <= 110)) + { + double percentForce = (0.6); + double percentLength = (370); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 90.01) & (ffspeed <= 110)) + { + double percentForce = (0.6); + double percentLength = (370); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 110.01) & (ffspeed <= 130)) + { + double percentForce = (0.7); + double percentLength = (400); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 110.01) & (ffspeed <= 130)) + { + double percentForce = (0.7); + double percentLength = (400); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed >= 130.01) & (ffspeed <= 150)) + { + double percentForce = (0.9); + double percentLength = (450); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed >= 130.01) & (ffspeed <= 150)) + { + double percentForce = (0.9); + double percentLength = (450); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((2000000 < ff) & (ff < 4000000) & (ffspeed > 150.01)) + { + double percentForce = (1.0); + double percentLength = (500); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((1000000 < ff) & (ff < 1600000) & (ffspeed > 150.01)) + { + double percentForce = (1.0); + double percentLength = (500); + triggers->Rumble(percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((0.00000000000000000001 < ff2) & (ffspeed > 0.01)) + { + double percentForce = (0.1); + double percentLength = (50); + triggers->LeftRight(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->LeftRight(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 new file mode 100644 index 0000000..bcbd8ae --- /dev/null +++ b/Game Files/BG4JP.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class BG4JP : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/ButtonRumble32bit.cpp b/Game Files/ButtonRumble32bit.cpp new file mode 100644 index 0000000..01162a8 --- /dev/null +++ b/Game Files/ButtonRumble32bit.cpp @@ -0,0 +1,318 @@ +#include +#include "ButtonRumble32bit.h" +#include "SDL.h" +#include +extern int joystick_index1; +extern int joystick_index2; +extern SDL_Joystick* GameController2; +extern SDL_Haptic* ControllerHaptic2; +extern SDL_Haptic* haptic2; + +void ButtonRumble32bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename); + int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename); + int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename); + int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename); + int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename); + int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename); + int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename); + int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename); + int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename); + int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename); + int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename); + int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename); + int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename); + int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename); + int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename); + int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename); + int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename); + int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename); + int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename); + int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename); + int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename); + int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename); + int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename); + int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename); + int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename); + int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename); + + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + 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); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + std::string njs = std::to_string(numJoysticks); + ((char)njs.c_str()); + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + extern int joystick1Index; + if (i == joystick1Index) + { + continue; + } + SDL_Joystick* js2 = SDL_JoystickOpen(i); + joystick_index2 = SDL_JoystickInstanceID(js2); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2); + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + const char* name = SDL_JoystickName(js2); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js2); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + GameController2 = SDL_JoystickOpen(i); + ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2); + break; + } + SDL_JoystickClose(js2); + } + haptic2 = ControllerHaptic2; + if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE)) + { + SDL_HapticRumbleInit; + SDL_HapticRumbleInit(ControllerHaptic2); + } + } + + SDL_Event e; + while (SDL_PollEvent(&e) != 0) + { + if (ShowButtonNumbersForSetup == 1) + { + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jbutton.button == 0) + { + MessageBoxA(NULL, "Button 0 Pressed", "", 0); + } + else if (e.jbutton.button == 1) + { + MessageBoxA(NULL, "Button 1 Pressed", "", 0); + } + else if (e.jbutton.button == 2) + { + MessageBoxA(NULL, "Button 2 Pressed", "", 0); + } + else if (e.jbutton.button == 3) + { + MessageBoxA(NULL, "Button 3 Pressed", "", 0); + } + else if (e.jbutton.button == 4) + { + MessageBoxA(NULL, "Button 4 Pressed", "", 0); + } + else if (e.jbutton.button == 5) + { + MessageBoxA(NULL, "Button 5 Pressed", "", 0); + } + else if (e.jbutton.button == 6) + { + MessageBoxA(NULL, "Button 6 Pressed", "", 0); + } + else if (e.jbutton.button == 7) + { + MessageBoxA(NULL, "Button 7 Pressed", "", 0); + } + else if (e.jbutton.button == 8) + { + MessageBoxA(NULL, "Button 8 Pressed", "", 0); + } + else if (e.jbutton.button == 9) + { + MessageBoxA(NULL, "Button 9 Pressed", "", 0); + } + else if (e.jbutton.button == 10) + { + MessageBoxA(NULL, "Button 10 Pressed", "", 0); + } + else if (e.jbutton.button == 11) + { + MessageBoxA(NULL, "Button 11 Pressed", "", 0); + } + else if (e.jbutton.button == 12) + { + MessageBoxA(NULL, "Button 12 Pressed", "", 0); + } + else if (e.jbutton.button == 13) + { + MessageBoxA(NULL, "Button 13 Pressed", "", 0); + } + else if (e.jbutton.button == 14) + { + MessageBoxA(NULL, "Button 14 Pressed", "", 0); + } + else if (e.jbutton.button == 15) + { + MessageBoxA(NULL, "Button 15 Pressed", "", 0); + } + else if (e.jbutton.button == 16) + { + MessageBoxA(NULL, "Button 16 Pressed", "", 0); + } + else if (e.jbutton.button == 17) + { + MessageBoxA(NULL, "Button 17 Pressed", "", 0); + } + else if (e.jbutton.button == 18) + { + MessageBoxA(NULL, "Button 18 Pressed", "", 0); + } + else if (e.jbutton.button == 19) + { + MessageBoxA(NULL, "Button 19 Pressed", "", 0); + } + else if (e.jbutton.button == 20) + { + MessageBoxA(NULL, "Button 20 Pressed", "", 0); + } + else if (e.jbutton.button == 21) + { + MessageBoxA(NULL, "Button 21 Pressed", "", 0); + } + else if (e.jbutton.button == 22) + { + MessageBoxA(NULL, "Button 22 Pressed", "", 0); + } + else if (e.jbutton.button == 23) + { + MessageBoxA(NULL, "Button 23 Pressed", "", 0); + } + else if (e.jbutton.button == 24) + { + MessageBoxA(NULL, "Button 24 Pressed", "", 0); + } + else if (e.jbutton.button == 25) + { + MessageBoxA(NULL, "Button 25 Pressed", "", 0); + } + else if (e.jbutton.button == 26) + { + MessageBoxA(NULL, "Button 26 Pressed", "", 0); + } + else if (e.jbutton.button == 27) + { + MessageBoxA(NULL, "Button 27 Pressed", "", 0); + } + else if (e.jbutton.button == 28) + { + MessageBoxA(NULL, "Button 28 Pressed", "", 0); + } + else if (e.jbutton.button == 29) + { + MessageBoxA(NULL, "Button 29 Pressed", "", 0); + } + else if (e.jbutton.button == 30) + { + MessageBoxA(NULL, "Button 30 Pressed", "", 0); + } + } + } + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jaxis.which == joystick_index1) + { + if ((BothRumbleMotor == 1) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 1) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(0, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 1)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + } + } + if (e.jaxis.which == joystick_index2) + { + if ((BothRumbleMotor == 1) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 1) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 1)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + } + } + } + if (e.type == SDL_JOYBUTTONUP) + { + if (e.jaxis.which == joystick_index1) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(0, 0, percentLength); + } + } + } + if (e.jaxis.which == joystick_index2) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(0, 0, percentLength); + } + } + } + } + } + } \ No newline at end of file diff --git a/Game Files/ButtonRumble32bit.h b/Game Files/ButtonRumble32bit.h new file mode 100644 index 0000000..6a3cf11 --- /dev/null +++ b/Game Files/ButtonRumble32bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class ButtonRumble32bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/ButtonRumble64bit.cpp b/Game Files/ButtonRumble64bit.cpp new file mode 100644 index 0000000..dcf32d4 --- /dev/null +++ b/Game Files/ButtonRumble64bit.cpp @@ -0,0 +1,318 @@ +#include +#include "ButtonRumble64bit.h" +#include "SDL.h" +#include +extern int joystick_index1; +extern int joystick_index2; +extern SDL_Joystick* GameController2; +extern SDL_Haptic* ControllerHaptic2; +extern SDL_Haptic* haptic2; + +void ButtonRumble64bit::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename); + int BothRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("BothRumbleMotor"), 0, settingsFilename); + int LeftRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("LeftRumbleMotor"), 0, settingsFilename); + int RightRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RightRumbleMotor"), 0, settingsFilename); + int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename); + int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename); + int Button1Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Rumble"), 0, settingsFilename); + int Button2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Rumble"), 0, settingsFilename); + int Button3Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Rumble"), 0, settingsFilename); + int Button4Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Rumble"), 0, settingsFilename); + int Button5Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Rumble"), 0, settingsFilename); + int Button6Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Rumble"), 0, settingsFilename); + int Button7Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Rumble"), 0, settingsFilename); + int Button8Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Rumble"), 0, settingsFilename); + int Button9Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Rumble"), 0, settingsFilename); + int Button10Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Rumble"), 0, settingsFilename); + int Button1Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button1Device2Rumble"), 0, settingsFilename); + int Button2Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button2Device2Rumble"), 0, settingsFilename); + int Button3Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button3Device2Rumble"), 0, settingsFilename); + int Button4Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button4Device2Rumble"), 0, settingsFilename); + int Button5Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button5Device2Rumble"), 0, settingsFilename); + int Button6Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button6Device2Rumble"), 0, settingsFilename); + int Button7Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button7Device2Rumble"), 0, settingsFilename); + int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button8Device2Rumble"), 0, settingsFilename); + int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename); + int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename); + + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + 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); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + std::string njs = std::to_string(numJoysticks); + ((char)njs.c_str()); + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + extern int joystick1Index; + if (i == joystick1Index) + { + continue; + } + SDL_Joystick* js2 = SDL_JoystickOpen(i); + joystick_index2 = SDL_JoystickInstanceID(js2); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2); + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + const char* name = SDL_JoystickName(js2); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js2); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + GameController2 = SDL_JoystickOpen(i); + ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2); + break; + } + SDL_JoystickClose(js2); + } + haptic2 = ControllerHaptic2; + if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE)) + { + SDL_HapticRumbleInit; + SDL_HapticRumbleInit(ControllerHaptic2); + } + } + + SDL_Event e; + while (SDL_PollEvent(&e) != 0) + { + if (ShowButtonNumbersForSetup == 1) + { + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jbutton.button == 0) + { + MessageBoxA(NULL, "Button 0 Pressed", "", 0); + } + else if (e.jbutton.button == 1) + { + MessageBoxA(NULL, "Button 1 Pressed", "", 0); + } + else if (e.jbutton.button == 2) + { + MessageBoxA(NULL, "Button 2 Pressed", "", 0); + } + else if (e.jbutton.button == 3) + { + MessageBoxA(NULL, "Button 3 Pressed", "", 0); + } + else if (e.jbutton.button == 4) + { + MessageBoxA(NULL, "Button 4 Pressed", "", 0); + } + else if (e.jbutton.button == 5) + { + MessageBoxA(NULL, "Button 5 Pressed", "", 0); + } + else if (e.jbutton.button == 6) + { + MessageBoxA(NULL, "Button 6 Pressed", "", 0); + } + else if (e.jbutton.button == 7) + { + MessageBoxA(NULL, "Button 7 Pressed", "", 0); + } + else if (e.jbutton.button == 8) + { + MessageBoxA(NULL, "Button 8 Pressed", "", 0); + } + else if (e.jbutton.button == 9) + { + MessageBoxA(NULL, "Button 9 Pressed", "", 0); + } + else if (e.jbutton.button == 10) + { + MessageBoxA(NULL, "Button 10 Pressed", "", 0); + } + else if (e.jbutton.button == 11) + { + MessageBoxA(NULL, "Button 11 Pressed", "", 0); + } + else if (e.jbutton.button == 12) + { + MessageBoxA(NULL, "Button 12 Pressed", "", 0); + } + else if (e.jbutton.button == 13) + { + MessageBoxA(NULL, "Button 13 Pressed", "", 0); + } + else if (e.jbutton.button == 14) + { + MessageBoxA(NULL, "Button 14 Pressed", "", 0); + } + else if (e.jbutton.button == 15) + { + MessageBoxA(NULL, "Button 15 Pressed", "", 0); + } + else if (e.jbutton.button == 16) + { + MessageBoxA(NULL, "Button 16 Pressed", "", 0); + } + else if (e.jbutton.button == 17) + { + MessageBoxA(NULL, "Button 17 Pressed", "", 0); + } + else if (e.jbutton.button == 18) + { + MessageBoxA(NULL, "Button 18 Pressed", "", 0); + } + else if (e.jbutton.button == 19) + { + MessageBoxA(NULL, "Button 19 Pressed", "", 0); + } + else if (e.jbutton.button == 20) + { + MessageBoxA(NULL, "Button 20 Pressed", "", 0); + } + else if (e.jbutton.button == 21) + { + MessageBoxA(NULL, "Button 21 Pressed", "", 0); + } + else if (e.jbutton.button == 22) + { + MessageBoxA(NULL, "Button 22 Pressed", "", 0); + } + else if (e.jbutton.button == 23) + { + MessageBoxA(NULL, "Button 23 Pressed", "", 0); + } + else if (e.jbutton.button == 24) + { + MessageBoxA(NULL, "Button 24 Pressed", "", 0); + } + else if (e.jbutton.button == 25) + { + MessageBoxA(NULL, "Button 25 Pressed", "", 0); + } + else if (e.jbutton.button == 26) + { + MessageBoxA(NULL, "Button 26 Pressed", "", 0); + } + else if (e.jbutton.button == 27) + { + MessageBoxA(NULL, "Button 27 Pressed", "", 0); + } + else if (e.jbutton.button == 28) + { + MessageBoxA(NULL, "Button 28 Pressed", "", 0); + } + else if (e.jbutton.button == 29) + { + MessageBoxA(NULL, "Button 29 Pressed", "", 0); + } + else if (e.jbutton.button == 30) + { + MessageBoxA(NULL, "Button 30 Pressed", "", 0); + } + } + } + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jaxis.which == joystick_index1) + { + if ((BothRumbleMotor == 1) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 1) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(0, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 1)) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + } + } + if (e.jaxis.which == joystick_index2) + { + if ((BothRumbleMotor == 1) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 1) & (RightRumbleMotor == 0)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + } + } + if ((BothRumbleMotor == 0) & (LeftRumbleMotor == 0) & (RightRumbleMotor == 1)) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + } + } + } + if (e.type == SDL_JOYBUTTONUP) + { + if (e.jaxis.which == joystick_index1) + { + if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(0, 0, percentLength); + } + } + } + if (e.jaxis.which == joystick_index2) + { + if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble) + { + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRightDevice2(0, 0, percentLength); + } + } + } + } + } + } \ No newline at end of file diff --git a/Game Files/ButtonRumble64bit.h b/Game Files/ButtonRumble64bit.h new file mode 100644 index 0000000..80cc56c --- /dev/null +++ b/Game Files/ButtonRumble64bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class ButtonRumble64bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/ChaseHQ2.cpp b/Game Files/ChaseHQ2.cpp new file mode 100644 index 0000000..f237cd6 --- /dev/null +++ b/Game Files/ChaseHQ2.cpp @@ -0,0 +1,124 @@ +#include +#include "ChaseHQ2.h" + +int ttx2chasehq2(int ffRaw) { + switch (ffRaw) { + // moving right, from weakest to strongest (30 => 16). + case 28672: + return 30; + case 24640: + return 29; + case 28736: + return 28; + case 16624: + return 27; + case 30720: + return 26; + case 26688: + return 25; + case 30784: + return 24; + case 24608: + return 23; + case 28704: + return 22; + case 24672: + return 21; + case 28768: + return 20; + case 26656: + return 19; + case 30752: + return 18; + case 26720: + return 17; + case 30816: + return 16; + + // moving left, from weakest to strongest (15 => 1) + case 20480: + return 15; + case 16448: + return 14; + case 20544: + return 13; + case 18432: + return 12; + case 22528: + return 11; + case 18496: + return 10; + case 22592: + return 9; + case 16416: + return 8; + case 20512: + return 7; + case 16480: + return 6; + case 20576: + return 5; + case 18464: + return 4; + case 22560: + return 3; + case 18528: + return 2; + case 22624: + return 1; + default: + return 0; + + } +} + +void ChaseHQ2::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + int ff = 0; + { + 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->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff + lastWasStop = 0; + } + else if (ff > 0) + { + helpers->log("moving wheel left"); + // assume that 1 is the strongest and 15 is the weakest + double percentForce = (16 - ff) / 15.0; + double percentLength = 100; + // direction from right => makes wheel turn left + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } + } +} \ No newline at end of file diff --git a/Game Files/ChaseHQ2.h b/Game Files/ChaseHQ2.h new file mode 100644 index 0000000..7e810fc --- /dev/null +++ b/Game Files/ChaseHQ2.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class ChaseHQ2 : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/Daytona3.cpp b/Game Files/Daytona3.cpp new file mode 100644 index 0000000..853491a --- /dev/null +++ b/Game Files/Daytona3.cpp @@ -0,0 +1,277 @@ +#include +#include "Daytona3.h" +#include "SDL.h" +#include + +void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + int ff = helpers->ReadInt32(0x15AFC46, /* isRelativeOffset */ false); + int gamestate = helpers->ReadInt32(0x19B5744, /* isRelativeOffset */ false); + UINT8 gear = helpers->ReadByte(0x019B468C, /* isRelativeOffset */ false); + UINT8 steering = helpers->ReadByte(0x019B4678, /* 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 ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename); + int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename); + int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename); + int MenuMovementViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("MenuMovementViaPlugin"), 0, settingsFilename); + int Gear1 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear1"), 0, settingsFilename); + int Gear2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear2"), 0, settingsFilename); + int Gear3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear3"), 0, settingsFilename); + int Gear4 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear4"), 0, settingsFilename); + int GearUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearUp"), 0, settingsFilename); + int GearDown = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearDown"), 0, settingsFilename); + int HideCursor = GetPrivateProfileInt(TEXT("Settings"), TEXT("HideCursor"), 0, settingsFilename); + + if (HideCursor == 1) + { + SetCursorPos(2000, 2000); + } + + SDL_Event e; + while (SDL_PollEvent(&e) != 0) + { + /* if (e.type == SDL_KEYDOWN) + { + if (e.key.keysym.sym == SDLK_ESCAPE) + { + MessageBoxA(NULL, "test", "", 0); + } + } */ + if (ShowButtonNumbersForSetup == 1) + { + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jbutton.button == 0) + { + MessageBoxA(NULL, "Button 0 Pressed", "", 0); + } + else if (e.jbutton.button == 1) + { + MessageBoxA(NULL, "Button 1 Pressed", "", 0); + } + else if (e.jbutton.button == 2) + { + MessageBoxA(NULL, "Button 2 Pressed", "", 0); + } + else if (e.jbutton.button == 3) + { + MessageBoxA(NULL, "Button 3 Pressed", "", 0); + } + else if (e.jbutton.button == 4) + { + MessageBoxA(NULL, "Button 4 Pressed", "", 0); + } + else if (e.jbutton.button == 5) + { + MessageBoxA(NULL, "Button 5 Pressed", "", 0); + } + else if (e.jbutton.button == 6) + { + MessageBoxA(NULL, "Button 6 Pressed", "", 0); + } + else if (e.jbutton.button == 7) + { + MessageBoxA(NULL, "Button 7 Pressed", "", 0); + } + else if (e.jbutton.button == 8) + { + MessageBoxA(NULL, "Button 8 Pressed", "", 0); + } + else if (e.jbutton.button == 9) + { + MessageBoxA(NULL, "Button 9 Pressed", "", 0); + } + else if (e.jbutton.button == 10) + { + MessageBoxA(NULL, "Button 10 Pressed", "", 0); + } + else if (e.jbutton.button == 11) + { + MessageBoxA(NULL, "Button 11 Pressed", "", 0); + } + else if (e.jbutton.button == 12) + { + MessageBoxA(NULL, "Button 12 Pressed", "", 0); + } + else if (e.jbutton.button == 13) + { + MessageBoxA(NULL, "Button 13 Pressed", "", 0); + } + else if (e.jbutton.button == 14) + { + MessageBoxA(NULL, "Button 14 Pressed", "", 0); + } + else if (e.jbutton.button == 15) + { + MessageBoxA(NULL, "Button 15 Pressed", "", 0); + } + else if (e.jbutton.button == 16) + { + MessageBoxA(NULL, "Button 16 Pressed", "", 0); + } + else if (e.jbutton.button == 17) + { + MessageBoxA(NULL, "Button 17 Pressed", "", 0); + } + else if (e.jbutton.button == 18) + { + MessageBoxA(NULL, "Button 18 Pressed", "", 0); + } + else if (e.jbutton.button == 19) + { + MessageBoxA(NULL, "Button 19 Pressed", "", 0); + } + else if (e.jbutton.button == 20) + { + MessageBoxA(NULL, "Button 20 Pressed", "", 0); + } + else if (e.jbutton.button == 21) + { + MessageBoxA(NULL, "Button 21 Pressed", "", 0); + } + else if (e.jbutton.button == 22) + { + MessageBoxA(NULL, "Button 22 Pressed", "", 0); + } + else if (e.jbutton.button == 23) + { + MessageBoxA(NULL, "Button 23 Pressed", "", 0); + } + else if (e.jbutton.button == 24) + { + MessageBoxA(NULL, "Button 24 Pressed", "", 0); + } + else if (e.jbutton.button == 25) + { + MessageBoxA(NULL, "Button 25 Pressed", "", 0); + } + else if (e.jbutton.button == 26) + { + MessageBoxA(NULL, "Button 26 Pressed", "", 0); + } + else if (e.jbutton.button == 27) + { + MessageBoxA(NULL, "Button 27 Pressed", "", 0); + } + else if (e.jbutton.button == 28) + { + MessageBoxA(NULL, "Button 28 Pressed", "", 0); + } + else if (e.jbutton.button == 29) + { + MessageBoxA(NULL, "Button 29 Pressed", "", 0); + } + else if (e.jbutton.button == 30) + { + MessageBoxA(NULL, "Button 30 Pressed", "", 0); + } + } + } + if (e.type == SDL_JOYBUTTONDOWN) + { + if (ChangeGearsViaPlugin == 1) + { + if (e.jbutton.button == Gear1) + { + helpers->WriteByte(0x019B468C, 0x00, false); + } + else if (e.jbutton.button == Gear2) + { + helpers->WriteByte(0x019B468C, 0x02, false); + } + else if (e.jbutton.button == Gear3) + { + helpers->WriteByte(0x019B468C, 0x01, false); + } + else if (e.jbutton.button == Gear4) + { + helpers->WriteByte(0x019B468C, 0x03, false); + } + else if ((e.jbutton.button == GearDown) && (gear > 0x00)) + { + helpers->WriteByte(0x019B468C, --gear, false); + } + else if ((e.jbutton.button == GearUp) && (gear < 0x03)) + { + helpers->WriteByte(0x019B468C, ++gear, false); + } + } + } + } + if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1)) + { + system("taskkill /f /im Daytona.exe"); + system("taskkill /f /im InpWrapper.exe"); + } + + if ((steering > 137) & (gamestate == 18) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_RIGHT, 0x25, 0, 0); + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + Sleep(100); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + } + else if ((steering > 117 & steering < 138) & (gamestate == 18) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + } + else if ((steering < 118) & (gamestate == 18) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_LEFT, 0x25, 0, 0); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + Sleep(100); + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + } + if ((steering > 137) & (gamestate == 30) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_RIGHT, 0x25, 0, 0); + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + Sleep(100); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + } + else if ((steering > 117 & steering < 138) & (gamestate == 30) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + } + else if ((steering < 118) & (gamestate == 30) && (MenuMovementViaPlugin == 1)) + { + keybd_event(VK_LEFT, 0x25, 0, 0); + keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0); + Sleep(100); + keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0); + } + + if (ff > 15) + { + helpers->log("moving wheel right"); + // assume that 30 is the weakest and 16 is the strongest + double percentForce = (31 - ff) / 15.0; + double percentLength = 100; + // direction from left => makes wheel turn right + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff + lastWasStop = 0; + } + else if (ff > 0) + { + helpers->log("moving wheel left"); + // assume that 1 is the strongest and 15 is the weakest + double percentForce = (16 - ff) / 15.0; + double percentLength = 100; + // direction from right => makes wheel turn left + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff + lastWasStop = 0; + } + else + { + if (lastWasStop == 0) { + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); // just pass the hash of 0 strength so we update lastEffectHash & lastEffectTime + lastWasStop = 1; + } + } + } \ No newline at end of file diff --git a/Game Files/Daytona3.h b/Game Files/Daytona3.h new file mode 100644 index 0000000..2e66fb0 --- /dev/null +++ b/Game Files/Daytona3.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class Daytona3 : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/Demul.cpp b/Game Files/Demul.cpp new file mode 100644 index 0000000..181eafd --- /dev/null +++ b/Game Files/Demul.cpp @@ -0,0 +1,161 @@ +#include +#include +#include "Demul.h" +#include "math.h" +#include +#include +#include + +int nascar(int ffnas) { + switch (ffnas) { + + case 0x04: + return 32; + case 0x84: + return 31; + case 0x44: + return 30; + case 0xC4: + return 29; + case 0x24: + return 28; + case 0xA4: + return 27; + case 0x64: + return 26; + case 0xE4: + return 25; + case 0x14: + return 24; + case 0x94: + return 23; + case 0x54: + return 22; + case 0xD4: + return 21; + case 0x34: + return 20; + case 0xB4: + return 19; + case 0x74: + return 18; + case 0xF4: + return 17; + + case 0xFC: + return 16; + case 0x7C: + return 15; + case 0xBC: + return 14; + case 0x3C: + return 13; + case 0xDC: + return 12; + case 0x5C: + return 11; + case 0x9C: + return 10; + case 0x1C: + return 9; + case 0xEC: + return 8; + case 0x6C: + return 7; + case 0xAC: + return 6; + case 0x2C: + return 5; + case 0xCC: + return 4; + case 0x4C: + return 3; + case 0x8C: + return 2; + case 0x0C: + return 1; + default: + return 0; + } +} + +BOOL CALLBACK FindWindowBySubstr(HWND hwnd, LPARAM substring) +{ + const DWORD TITLE_SIZE = 1024; + TCHAR windowTitle[TITLE_SIZE]; + + if (GetWindowText(hwnd, windowTitle, TITLE_SIZE)) + { + //_tprintf(TEXT("%s\n"), windowTitle); + // Uncomment to print all windows being enumerated + if (_tcsstr(windowTitle, LPCTSTR(substring)) != NULL) + { + // We found the window! Stop enumerating. + return false; + } + } + return true; // Need to continue enumerating windows +} + +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); + + { + int ffnascar = 0; + { + if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring)) + { + 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 ((ffnascar > 16) & (ffnascar < 33)) + { + helpers->log("moving wheel left"); + double percentForce = (ffnascar - 16) / 16.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffnascar > 0) & (ffnascar < 17)) + { + helpers->log("moving wheel right"); + double percentForce = (17 - ffnascar) / 16.0; + double percentLength = 100; + triggers->LeftRight(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->LeftRight(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->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + } + } + +} + diff --git a/Game Files/Demul.h b/Game Files/Demul.h new file mode 100644 index 0000000..ed2032c --- /dev/null +++ b/Game Files/Demul.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class Demul : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/FNF.cpp b/Game Files/FNF.cpp new file mode 100644 index 0000000..d2ab091 --- /dev/null +++ b/Game Files/FNF.cpp @@ -0,0 +1,6 @@ +#include +#include "FNF.h" + + +void FNF::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { +} \ No newline at end of file diff --git a/Game Files/FNF.h b/Game Files/FNF.h new file mode 100644 index 0000000..f653f94 --- /dev/null +++ b/Game Files/FNF.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class FNF : public Game { + int lastWasStop = 0; + + public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/FordRacing.cpp b/Game Files/FordRacing.cpp new file mode 100644 index 0000000..2680ccd --- /dev/null +++ b/Game Files/FordRacing.cpp @@ -0,0 +1,42 @@ +#include +#include "FordRacing.h" + +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()); + + if (ff < -65505 && ff > -65515) + { + 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->LeftRight(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->LeftRight(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 new file mode 100644 index 0000000..65f0434 --- /dev/null +++ b/Game Files/FordRacing.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +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/GTIClub3.cpp b/Game Files/GTIClub3.cpp new file mode 100644 index 0000000..087971e --- /dev/null +++ b/Game Files/GTIClub3.cpp @@ -0,0 +1,68 @@ +#include +#include "GTIClub3.h" +#include "math.h" + +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()); + + if (FFBMode == 0) + { + if ((ff1 > 0x00) & (ff1 < 0x40) & (menu == 0)) + { + double percentForce = (ff1) / 63.0; + double percentLength = 100; + triggers->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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/GTIClub3.h b/Game Files/GTIClub3.h new file mode 100644 index 0000000..dac9107 --- /dev/null +++ b/Game Files/GTIClub3.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class GTIClub3 : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/InitialD4.cpp b/Game Files/InitialD4.cpp new file mode 100644 index 0000000..3e7daa3 --- /dev/null +++ b/Game Files/InitialD4.cpp @@ -0,0 +1,47 @@ +#include +#include "InitialD4.h" +#include "math.h" + +void InitialD4::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers){ + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + UINT8 ff = helpers->ReadByte(0x089AE89A, /* isRelativeOffset */ false); + UINT8 ff1 = helpers->ReadByte(0x089AE899, /* isRelativeOffset */ false); + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT,(pow(percentForce, 0.5))); + } +} \ No newline at end of file diff --git a/Game Files/InitialD4.h b/Game Files/InitialD4.h new file mode 100644 index 0000000..2c6bd2d --- /dev/null +++ b/Game Files/InitialD4.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class InitialD4 : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/InitialD4Japan.cpp b/Game Files/InitialD4Japan.cpp new file mode 100644 index 0000000..28615fd --- /dev/null +++ b/Game Files/InitialD4Japan.cpp @@ -0,0 +1,46 @@ +#include +#include "InitialD4Japan.h" +#include "math.h" + +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); + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } +} \ No newline at end of file diff --git a/Game Files/InitialD4Japan.h b/Game Files/InitialD4Japan.h new file mode 100644 index 0000000..1e0649c --- /dev/null +++ b/Game Files/InitialD4Japan.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class InitialD4Japan : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/InitialD5.cpp b/Game Files/InitialD5.cpp new file mode 100644 index 0000000..3b8bb9c --- /dev/null +++ b/Game Files/InitialD5.cpp @@ -0,0 +1,46 @@ +#include +#include "InitialD5.h" +#include "math.h" + +void InitialD5::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) { + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + UINT8 ff = helpers->ReadByte(0x08CB6122, /* isRelativeOffset */ false); + UINT8 ff1 = helpers->ReadByte(0x08CB6121, /* isRelativeOffset */ false); + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 0)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 0)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff > 0x37) & (ff < 0x80) & (ff1 == 0) & (FFBMode == 1)) + { + helpers->log("moving wheel right"); + double percentForce = (128 - ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff > 0x00) & (ff < 0x49) & (ff1 == 1) & (FFBMode == 1)) + { + helpers->log("moving wheel left"); + double percentForce = (ff) / 73.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } +} \ No newline at end of file diff --git a/Game Files/InitialD5.h b/Game Files/InitialD5.h new file mode 100644 index 0000000..87cd2cc --- /dev/null +++ b/Game Files/InitialD5.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class InitialD5 : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/InitialD6.cpp b/Game Files/InitialD6.cpp new file mode 100644 index 0000000..2463a72 --- /dev/null +++ b/Game Files/InitialD6.cpp @@ -0,0 +1,93 @@ +#include +#include "InitialD6.h" + +void InitialD6::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) +{ + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename); + helpers->log("in ID6 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x4005B) & (ff < 0x40080)) + { + helpers->log("moving wheel right"); + double percentForce = (262272 - ff) / 36.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x40100) & (ff < 0x40125)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 262400) / 36.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff >= 390001) && (ff <= 399999)) + { + helpers->log("sine1"); + double percentForce = (ff - 390000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(120, 100, percentForce); + } + else if ((ff >= 380001) && (ff <= 389999)) + { + helpers->log("sine2"); + double percentLength = 100; + double percentForce = (ff - 380000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(130, 120, percentForce); + } + else if ((ff >= 370001) && (ff <= 379999)) + { + helpers->log("sine3"); + double percentLength = 100; + double percentForce = (ff - 370000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(140, 140, percentForce); + } + else if ((ff >= 360001) && (ff <= 369999)) + { + helpers->log("sine4"); + double percentForce = (ff - 360000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(150, 150, percentForce); + } + else if ((ff >= 350001) && (ff <= 359999)) + { + helpers->log("sine5"); + double percentLength = 100; + double percentForce = (ff - 350000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(160, 160, percentForce); + } + else if ((ff >= 340001) && (ff <= 349999)) + { + helpers->log("sine6"); + double percentLength = 100; + double percentForce = (ff - 340000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(170, 170, percentForce); + } + else if ((ff >= 330001) && (ff <= 339999)) + { + helpers->log("sine7"); + double percentLength = 100; + double percentForce = (ff - 330000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(180, 180, percentForce); + } + else if ((ff >= 327681) && (ff <= 329999)) + { + helpers->log("sine8"); + double percentLength = 100; + double percentForce = (ff - 327680) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(190, 190, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/InitialD6.h b/Game Files/InitialD6.h new file mode 100644 index 0000000..5066703 --- /dev/null +++ b/Game Files/InitialD6.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +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 new file mode 100644 index 0000000..da96474 --- /dev/null +++ b/Game Files/InitialD7.cpp @@ -0,0 +1,93 @@ +#include +#include "InitialD7.h" + +void InitialD7::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) +{ + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename); + helpers->log("in ID6 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x4005B) & (ff < 0x40080)) + { + helpers->log("moving wheel right"); + double percentForce = (262272 - ff) / 36.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x40100) & (ff < 0x40125)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 262400) / 36.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff >= 390001) && (ff <= 399999)) + { + helpers->log("sine1"); + double percentForce = (ff - 390000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(120, 100, percentForce); + } + else if ((ff >= 380001) && (ff <= 389999)) + { + helpers->log("sine2"); + double percentLength = 100; + double percentForce = (ff - 380000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(130, 120, percentForce); + } + else if ((ff >= 370001) && (ff <= 379999)) + { + helpers->log("sine3"); + double percentLength = 100; + double percentForce = (ff - 370000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(140, 140, percentForce); + } + else if ((ff >= 360001) && (ff <= 369999)) + { + helpers->log("sine4"); + double percentForce = (ff - 360000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(150, 150, percentForce); + } + else if ((ff >= 350001) && (ff <= 359999)) + { + helpers->log("sine5"); + double percentLength = 100; + double percentForce = (ff - 350000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(160, 160, percentForce); + } + else if ((ff >= 340001) && (ff <= 349999)) + { + helpers->log("sine6"); + double percentLength = 100; + double percentForce = (ff - 340000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(170, 170, percentForce); + } + else if ((ff >= 330001) && (ff <= 339999)) + { + helpers->log("sine7"); + double percentLength = 100; + double percentForce = (ff - 330000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(180, 180, percentForce); + } + else if ((ff >= 327681) && (ff <= 329999)) + { + helpers->log("sine8"); + double percentLength = 100; + double percentForce = (ff - 327680) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(190, 190, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/InitialD7.h b/Game Files/InitialD7.h new file mode 100644 index 0000000..e58373a --- /dev/null +++ b/Game Files/InitialD7.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +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 new file mode 100644 index 0000000..9f35b64 --- /dev/null +++ b/Game Files/InitialD8.cpp @@ -0,0 +1,93 @@ +#include +#include "InitialD8.h" + +void InitialD8::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) +{ + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int SineDivision = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineDivision"), 0, settingsFilename); + helpers->log("in ID6 Ffbloop"); + const int ff = GetTeknoParrotFFB(); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + if ((ff > 0x4005B) & (ff < 0x40080)) + { + helpers->log("moving wheel right"); + double percentForce = (262272 - ff) / 36.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff > 0x40100) & (ff < 0x40125)) + { + helpers->log("moving wheel left"); + double percentForce = (ff - 262400) / 36.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff >= 390001) && (ff <= 399999)) + { + helpers->log("sine1"); + double percentForce = (ff - 390000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(120, 100, percentForce); + } + else if ((ff >= 380001) && (ff <= 389999)) + { + helpers->log("sine2"); + double percentLength = 100; + double percentForce = (ff - 380000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(130, 120, percentForce); + } + else if ((ff >= 370001) && (ff <= 379999)) + { + helpers->log("sine3"); + double percentLength = 100; + double percentForce = (ff - 370000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(140, 140, percentForce); + } + else if ((ff >= 360001) && (ff <= 369999)) + { + helpers->log("sine4"); + double percentForce = (ff - 360000) / ((SineDivision) / 1.0); + double percentLength = 100; + triggers->Rumble(percentForce, percentLength); + triggers->Sine(150, 150, percentForce); + } + else if ((ff >= 350001) && (ff <= 359999)) + { + helpers->log("sine5"); + double percentLength = 100; + double percentForce = (ff - 350000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(160, 160, percentForce); + } + else if ((ff >= 340001) && (ff <= 349999)) + { + helpers->log("sine6"); + double percentLength = 100; + double percentForce = (ff - 340000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(170, 170, percentForce); + } + else if ((ff >= 330001) && (ff <= 339999)) + { + helpers->log("sine7"); + double percentLength = 100; + double percentForce = (ff - 330000) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(180, 180, percentForce); + } + else if ((ff >= 327681) && (ff <= 329999)) + { + helpers->log("sine8"); + double percentLength = 100; + double percentForce = (ff - 327680) / ((SineDivision) / 1.0); + triggers->Rumble(percentForce, percentLength); + triggers->Sine(190, 190, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/InitialD8.h b/Game Files/InitialD8.h new file mode 100644 index 0000000..65aa46d --- /dev/null +++ b/Game Files/InitialD8.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +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/LGI.cpp b/Game Files/LGI.cpp new file mode 100644 index 0000000..6539048 --- /dev/null +++ b/Game Files/LGI.cpp @@ -0,0 +1,258 @@ +#include +#include "LGI.h" +#include "SDL.h" +#include +extern int joystick_index1; +extern int joystick_index2; +extern SDL_Joystick* GameController2; +extern SDL_Haptic* ControllerHaptic2; +extern SDL_Haptic* haptic2; + +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; + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + 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]; + int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename); + char joystick_guid[256]; + sprintf(joystick_guid, "%S", deviceGUIDString2); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + std::string njs = std::to_string(numJoysticks); + ((char)njs.c_str()); + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + extern int joystick1Index; + if (i == joystick1Index) + { + continue; + } + SDL_Joystick* js2 = SDL_JoystickOpen(i); + joystick_index2 = SDL_JoystickInstanceID(js2); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2); + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + const char* name = SDL_JoystickName(js2); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js2); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + GameController2 = SDL_JoystickOpen(i); + ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2); + break; + } + SDL_JoystickClose(js2); + } + haptic2 = ControllerHaptic2; + if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE)) + { + SDL_HapticRumbleInit; + SDL_HapticRumbleInit(ControllerHaptic2); + } + } + + if ((oldFloat1 != newFloat1) && (health1p != 0x1)) + { + if (HowtoRumbleHealthEffect == 0) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 1) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 2) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if ((oldFloat2 != newFloat2) && (health2p != 0x1)) + { + if (HowtoRumbleHealthEffect == 0) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 1) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 2) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + if (ff1 == 0x20) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x40) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x4) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x8) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x24) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x48) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + oldFloat1 = newFloat1; + oldFloat2 = newFloat2; +} \ No newline at end of file diff --git a/Game Files/LGI.h b/Game Files/LGI.h new file mode 100644 index 0000000..f1b2fdf --- /dev/null +++ b/Game Files/LGI.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class LGI : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/LGI3D.cpp b/Game Files/LGI3D.cpp new file mode 100644 index 0000000..393898e --- /dev/null +++ b/Game Files/LGI3D.cpp @@ -0,0 +1,343 @@ +#include +#include "LGI3D.h" +#include "SDL.h" +#include +extern int joystick_index1; +extern int joystick_index2; +extern SDL_Haptic* haptic2; +extern SDL_Joystick* GameController2; +extern SDL_Haptic* ControllerHaptic2; + +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; + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + 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]; + int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename); + char joystick_guid[256]; + sprintf(joystick_guid, "%S", deviceGUIDString2); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + std::string njs = std::to_string(numJoysticks); + ((char)njs.c_str()); + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + extern int joystick1Index; + if (i == joystick1Index) + { + continue; + } + SDL_Joystick* js2 = SDL_JoystickOpen(i); + joystick_index2 = SDL_JoystickInstanceID(js2); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2); + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + const char* name = SDL_JoystickName(js2); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js2); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + GameController2 = SDL_JoystickOpen(i); + ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2); + break; + } + SDL_JoystickClose(js2); + } + haptic2 = ControllerHaptic2; + if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE)) + { + SDL_HapticRumbleInit; + SDL_HapticRumbleInit(ControllerHaptic2); + } + } + + if ((oldFloat1 != newFloat1) && (health1p != 0x1)) + { + if (HowtoRumbleHealthEffect == 0) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 1) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 2) + { + double percentForce = ((Health1pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if ((oldFloat2 != newFloat2) && (health2p != 0x1)) + { + if (HowtoRumbleHealthEffect == 0) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 1) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleHealthEffect == 2) + { + double percentForce = ((Health2pStrength) / 100.0); + double percentLength = (400); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + if (ff1 == 0x20) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x40) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x22) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x42) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x4) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x8) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x6) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0xA) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x24) + { + if (HowtoRumbleKnockEffect == 0) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 1) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleKnockEffect == 2) + { + double percentForce = ((Knock1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + else if (ff1 == 0x4A) + { + if (HowtoRumbleMotorEffect == 0) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->LeftRightDevice2(percentForce, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 1) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(0, percentForce, percentLength); + triggers->LeftRightDevice2(0, percentForce, percentLength); + } + else if (HowtoRumbleMotorEffect == 2) + { + double percentForce = ((Motor1pStrength) / 100.0); + double percentLength = (100); + triggers->LeftRight(percentForce, 0, percentLength); + triggers->LeftRightDevice2(percentForce, 0, percentLength); + } + } + oldFloat1 = newFloat1; + oldFloat2 = newFloat2; +} \ No newline at end of file diff --git a/Game Files/LGI3D.h b/Game Files/LGI3D.h new file mode 100644 index 0000000..28b0bcf --- /dev/null +++ b/Game Files/LGI3D.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class LGI3D : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/M2Emulator.cpp b/Game Files/M2Emulator.cpp new file mode 100644 index 0000000..d6e85be --- /dev/null +++ b/Game Files/M2Emulator.cpp @@ -0,0 +1,6062 @@ +#include +#include +#include "M2Emulator.h" +#include "math.h" +#include "SDL.h" + + +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)")); + + 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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) + { + 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); //DaytonaUSA + 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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 - 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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); + } + + 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: 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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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)) + { + //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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } diff --git a/Game Files/M2Emulator.h b/Game Files/M2Emulator.h new file mode 100644 index 0000000..99b1a48 --- /dev/null +++ b/Game Files/M2Emulator.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class M2Emulator : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; diff --git a/Game Files/Machstorm.cpp b/Game Files/Machstorm.cpp new file mode 100644 index 0000000..fb48309 --- /dev/null +++ b/Game Files/Machstorm.cpp @@ -0,0 +1,197 @@ +#include +#include "Machstorm.h" +typedef unsigned char U8; +typedef unsigned int U32; +typedef uint16_t U16; +void Machstorm::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + 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); + + /*if (DomeFix == 1) + { + U16 *buffer = new U16[1920 * 1080 * 2]; + + for (int y = 0; y < 1080; y++) + { + for (int x = 0; x < 1920; x++) + { + float d = 0.5f; + float xf = x / 1920.0f; + float yf = y / 1080.0f; + xf = 2.0f * xf - 1.0f; + yf = 2.0f * yf - 1.0f; + if (0.0f > xf) + { + float k = 0.95f * -xf / (-xf + d); + xf = -k; + yf = yf * (1.0f - k); + } + else + { + float k = 0.95f * xf / (xf + d); + xf = k; + yf = yf * (1.0f - k); + } + xf = 0.5f * xf + 0.5f; + yf = -0.5f * yf - 0.5f; + buffer[(y * 1920 + x) * 2] = 65535 * xf; + buffer[(y * 1920 + x) * 2 + 1] = 65535 * yf; + } + } + + helpers->WriteByte(0x003D2FEE, 0x45, true); + helpers->WriteByte(0x003D3637, 0xB8, true); + helpers->WriteIntPtr(0x003D3638, (U16)buffer, true); + helpers->WriteIntPtr(0x003D363C, 0x0C244489, true); + }*/ + + if (vibration == 16842753) + { + if (power == 61542) + { + double percentLength = (Power1RumbleLength); + double percentForce = ((Power1RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61543) + { + double percentLength = (Power2RumbleLength); + double percentForce = ((Power2RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61544) + { + double percentLength = (Power3RumbleLength); + double percentForce = ((Power3RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61545) + { + double percentLength = (Power4RumbleLength); + double percentForce = ((Power4RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61546) + { + double percentLength = (Power5RumbleLength); + double percentForce = ((Power5RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61547) + { + double percentLength = (Power6RumbleLength); + double percentForce = ((Power6RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61548) + { + double percentLength = (Power7RumbleLength); + double percentForce = ((Power7RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61549) + { + double percentLength = (Power8RumbleLength); + double percentForce = ((Power8RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61550) + { + double percentLength = (Power9RumbleLength); + double percentForce = ((Power9RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 61551) + { + double percentLength = (Power10RumbleLength); + double percentForce = ((Power10RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + } + if (vibration == 1) + { + if (power == 16773366) + { + double percentLength = (Power1RumbleLength); + double percentForce = ((Power1RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773367) + { + double percentLength = (Power2RumbleLength); + double percentForce = ((Power2RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773368) + { + double percentLength = (Power3RumbleLength); + double percentForce = ((Power3RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773369) + { + double percentLength = (Power4RumbleLength); + double percentForce = ((Power4RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773370) + { + double percentLength = (Power5RumbleLength); + double percentForce = ((Power5RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773371) + { + double percentLength = (Power6RumbleLength); + double percentForce = ((Power6RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773372) + { + double percentLength = (Power7RumbleLength); + double percentForce = ((Power7RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773373) + { + double percentLength = (Power8RumbleLength); + double percentForce = ((Power8RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773374) + { + double percentLength = (Power9RumbleLength); + double percentForce = ((Power9RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (power == 16773375) + { + double percentLength = (Power10RumbleLength); + double percentForce = ((Power10RumbleStrength) / 100.0); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + } +} \ No newline at end of file diff --git a/Game Files/Machstorm.h b/Game Files/Machstorm.h new file mode 100644 index 0000000..2656a8a --- /dev/null +++ b/Game Files/Machstorm.h @@ -0,0 +1,8 @@ +#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/Mame019932bit.cpp b/Game Files/Mame019932bit.cpp new file mode 100644 index 0000000..3fc4399 --- /dev/null +++ b/Game Files/Mame019932bit.cpp @@ -0,0 +1,3163 @@ +#include +#include +#include "Mame019932bit.h" +#include "math.h" + +static int sanfran(int ffsan) { + switch (ffsan) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int crusnwld(int ffcru) { + switch (ffcru) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0C: + return 9; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusa(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int raveracer(int ffRaw) { + switch (ffRaw) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +void Mame019932bit::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) + { + 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + else if (hWnd1 > 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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/Mame019932bit.h b/Game Files/Mame019932bit.h new file mode 100644 index 0000000..eb63646 --- /dev/null +++ b/Game Files/Mame019932bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class Mame019932bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/Mame019964bit.cpp b/Game Files/Mame019964bit.cpp new file mode 100644 index 0000000..a6d1571 --- /dev/null +++ b/Game Files/Mame019964bit.cpp @@ -0,0 +1,6559 @@ +#include +#include +#include "Mame019964bit.h" +#include "math.h" + +static int sanfran64(int ffsan64) { + switch (ffsan64) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int sanfran64hack(int ffsan64hack) { + switch (ffsan64hack) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int sanfran64ui(int ffsan64ui) { + switch (ffsan64ui) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int crusnwld64(int ffcru64) { + switch (ffcru64) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnwldui(int ffcruui) { + switch (ffcruui) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0C: + return 9; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusa64(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusaui(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int raveracer64(int ffRaw64) { + switch (ffRaw64) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +static int raveracerui64(int ffRawui64) { + switch (ffRawui64) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +void Mame019964bit::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) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ff2049464 = helpers->ReadIntPtr(ff2049364 + 0x130, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049464 + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0CF9F7D0, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x2D0, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + int ffsanfranrush64hack = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x668, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x764, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x8, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x18, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x54, /* isRelativeOffset */ false); //SanFranRush64bit mameui + INT_PTR ff64hack = helpers->ReadIntPtr(0x0C50CFE8, /* isRelativeOffset*/ true); + INT_PTR ff164hack = helpers->ReadIntPtr(ff64hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264hack = helpers->ReadIntPtr(ff164hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364hack = helpers->ReadIntPtr(ff264hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff464hack = helpers->ReadIntPtr(ff364hack + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64hack = helpers->ReadByte(ff464hack + 0x764, /* isRelativeOffset */ false); //SanFranRush64bithack + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + std::string ffs3 = std::to_string(ffsan64hack); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + ffsanfranrush64hack = sanfran64hack(ffsan64hack); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + else if (hWnd1 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + int ffsanfranrush64hack = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x668, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x764, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x8, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x18, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x54, /* isRelativeOffset */ false); //SanFranRush64bit mameui + INT_PTR ff64hack = helpers->ReadIntPtr(0x0C50CFE8, /* isRelativeOffset*/ true); + INT_PTR ff164hack = helpers->ReadIntPtr(ff64hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264hack = helpers->ReadIntPtr(ff164hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364hack = helpers->ReadIntPtr(ff264hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff464hack = helpers->ReadIntPtr(ff364hack + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64hack = helpers->ReadByte(ff464hack + 0x764, /* isRelativeOffset */ false); //SanFranRush64bithack + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + std::string ffs3 = std::to_string(ffsan64hack); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + ffsanfranrush64hack = sanfran64hack(ffsan64hack); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + else if (hWnd2 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + int ffsanfranrush64hack = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x668, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x764, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x8, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x18, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x54, /* isRelativeOffset */ false); //SanFranRush64bit mameui + INT_PTR ff64hack = helpers->ReadIntPtr(0x0C50CFE8, /* isRelativeOffset*/ true); + INT_PTR ff164hack = helpers->ReadIntPtr(ff64hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264hack = helpers->ReadIntPtr(ff164hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364hack = helpers->ReadIntPtr(ff264hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff464hack = helpers->ReadIntPtr(ff364hack + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64hack = helpers->ReadByte(ff464hack + 0x764, /* isRelativeOffset */ false); //SanFranRush64bithack + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + std::string ffs3 = std::to_string(ffsan64hack); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + ffsanfranrush64hack = sanfran64hack(ffsan64hack); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd3 > NULL) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ff2049464 = helpers->ReadIntPtr(ff2049364 + 0x130, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049464 + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0CF9F7D0, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x2D0, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd7 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + int ffsanfranrush64hack = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x668, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x764, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x1A0, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x8, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x18, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x54, /* isRelativeOffset */ false); //SanFranRush64bit mameui + INT_PTR ff64hack = helpers->ReadIntPtr(0x0C50CFE8, /* isRelativeOffset*/ true); + INT_PTR ff164hack = helpers->ReadIntPtr(ff64hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264hack = helpers->ReadIntPtr(ff164hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff364hack = helpers->ReadIntPtr(ff264hack + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff464hack = helpers->ReadIntPtr(ff364hack + 0x90, /* isRelativeOffset*/ false); + UINT8 ffsan64hack = helpers->ReadByte(ff464hack + 0x764, /* isRelativeOffset */ false); //SanFranRush64bithack + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + std::string ffs3 = std::to_string(ffsan64hack); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + ffsanfranrush64hack = sanfran64hack(ffsan64hack); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 112) & (ffsanfranrush64hack < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64hack) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64hack > 0) & (ffsanfranrush64hack < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64hack) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + if (hWnd4 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x130, /* isRelativeOffset*/ false); + INT_PTR ffrave644 = helpers->ReadIntPtr(ffrave643 + 0x720, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave644 + 0x42, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x740, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x1F8, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x42, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + + if (hWnd5 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x130, /* isRelativeOffset*/ false); + INT_PTR ffrave644 = helpers->ReadIntPtr(ffrave643 + 0x720, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave644 + 0x42, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x740, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x1F8, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x42, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd6 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x90, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x130, /* isRelativeOffset*/ false); + INT_PTR ffrave644 = helpers->ReadIntPtr(ffrave643 + 0x720, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave644 + 0x42, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x740, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x1F8, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x42, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd8 > NULL) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ff2049464 = helpers->ReadIntPtr(ff2049364 + 0x130, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049464 + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0CF9F7D0, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x2D0, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x79C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd9 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ffcal564 = helpers->ReadIntPtr(ffcal464 + 0x398, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal564 + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x140, /* isRelativeOffset*/ false); + INT_PTR ffcal564ui = helpers->ReadIntPtr(ffcal464ui + 0x408, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal564ui + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd10 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ffcal564 = helpers->ReadIntPtr(ffcal464 + 0x398, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal564 + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x140, /* isRelativeOffset*/ false); + INT_PTR ffcal564ui = helpers->ReadIntPtr(ffcal464ui + 0x408, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal564ui + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd11 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x310, /* isRelativeOffset*/ false); + INT_PTR ffcal564 = helpers->ReadIntPtr(ffcal464 + 0x398, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal564 + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x140, /* isRelativeOffset*/ false); + INT_PTR ffcal564ui = helpers->ReadIntPtr(ffcal464ui + 0x408, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal564ui + 0x5AC, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd12 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd13 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd14 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd15 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd16 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd17 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd18 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd19 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd20 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd21 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x774, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0xF0, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x1F0, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x774, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd22 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff564UI = helpers->ReadIntPtr(ffoff464UI + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff564UI + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd23 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff564UI = helpers->ReadIntPtr(ffoff464UI + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff564UI + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd24 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff564UI = helpers->ReadIntPtr(ffoff464UI + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff564UI + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd25 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff564UI = helpers->ReadIntPtr(ffoff464UI + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff564UI + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd26 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0C5E4FE8, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0C075FB8, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff564UI = helpers->ReadIntPtr(ffoff464UI + 0x0, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff564UI + 0x54, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + diff --git a/Game Files/Mame019964bit.h b/Game Files/Mame019964bit.h new file mode 100644 index 0000000..63e8997 --- /dev/null +++ b/Game Files/Mame019964bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class Mame019964bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/Mame020632bit.cpp b/Game Files/Mame020632bit.cpp new file mode 100644 index 0000000..7009e70 --- /dev/null +++ b/Game Files/Mame020632bit.cpp @@ -0,0 +1,3116 @@ +#include +#include +#include "Mame020632bit.h" +#include "math.h" + +static int sanfran(int ffsan) { + switch (ffsan) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int crusnwld(int ffcru) { + switch (ffcru) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0C: + return 9; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusa(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int raveracer(int ffRaw) { + switch (ffRaw) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +void Mame020632bit::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) + { + 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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 ((ffsanfranrush > 112) & (ffsanfranrush < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush) / 119.0; + double percentLength = 100; + triggers->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + else if (hWnd1 > 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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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/Mame020632bit.h b/Game Files/Mame020632bit.h new file mode 100644 index 0000000..789a68e --- /dev/null +++ b/Game Files/Mame020632bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class Mame020632bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/Mame020664bit.cpp b/Game Files/Mame020664bit.cpp new file mode 100644 index 0000000..122d321 --- /dev/null +++ b/Game Files/Mame020664bit.cpp @@ -0,0 +1,5903 @@ +#include +#include +#include "Mame020664bit.h" +#include "math.h" + +static int sanfran64(int ffsan64) { + switch (ffsan64) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int sanfran64ui(int ffsan64ui) { + switch (ffsan64ui) { + + case 0xFF: + return 232; + case 0xFE: + return 231; + case 0xFD: + return 230; + case 0xFC: + return 229; + case 0xFB: + return 228; + case 0xFA: + return 227; + case 0xF9: + return 226; + case 0xF8: + return 225; + case 0xF7: + return 224; + case 0xF6: + return 223; + case 0xF5: + return 222; + case 0xF4: + return 221; + case 0xF3: + return 220; + case 0xF2: + return 219; + case 0xF1: + return 218; + case 0xEF: + return 217; + case 0xEE: + return 216; + case 0xED: + return 215; + case 0xEC: + return 214; + case 0xEB: + return 213; + case 0xEA: + return 212; + case 0xE9: + return 211; + case 0xE8: + return 210; + case 0xE7: + return 209; + case 0xE6: + return 208; + case 0xE5: + return 207; + case 0xE4: + return 206; + case 0xE3: + return 205; + case 0xE2: + return 204; + case 0xE1: + return 203; + case 0xDF: + return 202; + case 0xDE: + return 201; + case 0xDD: + return 200; + case 0xDC: + return 199; + case 0xDB: + return 198; + case 0xDA: + return 197; + case 0xD9: + return 196; + case 0xD8: + return 195; + case 0xD7: + return 194; + case 0xD6: + return 193; + case 0xD5: + return 192; + case 0xD4: + return 191; + case 0xD3: + return 190; + case 0xD2: + return 189; + case 0xD1: + return 188; + case 0xCF: + return 187; + case 0xCE: + return 186; + case 0xCD: + return 185; + case 0xCC: + return 184; + case 0xCB: + return 183; + case 0xCA: + return 182; + case 0xC9: + return 181; + case 0xC8: + return 180; + case 0xC7: + return 179; + case 0xC6: + return 178; + case 0xC5: + return 177; + case 0xC4: + return 176; + case 0xC3: + return 175; + case 0xC2: + return 174; + case 0xC1: + return 173; + case 0xBF: + return 172; + case 0xBE: + return 171; + case 0xBD: + return 170; + case 0xBC: + return 169; + case 0xBB: + return 168; + case 0xBA: + return 167; + case 0xB9: + return 166; + case 0xB8: + return 165; + case 0xB7: + return 164; + case 0xB6: + return 163; + case 0xB5: + return 162; + case 0xB4: + return 161; + case 0xB3: + return 160; + case 0xB2: + return 159; + case 0xB1: + return 158; + case 0xAF: + return 157; + case 0xAE: + return 156; + case 0xAD: + return 155; + case 0xAC: + return 154; + case 0xAB: + return 153; + case 0xAA: + return 152; + case 0xA9: + return 151; + case 0xA8: + return 150; + case 0xA7: + return 149; + case 0xA6: + return 148; + case 0xA5: + return 147; + case 0xA4: + return 146; + case 0xA3: + return 145; + case 0xA2: + return 144; + case 0xA1: + return 143; + case 0x9F: + return 142; + case 0x9E: + return 141; + case 0x9D: + return 140; + case 0x9C: + return 139; + case 0x9B: + return 138; + case 0x9A: + return 137; + case 0x99: + return 136; + case 0x98: + return 135; + case 0x97: + return 134; + case 0x96: + return 133; + case 0x95: + return 132; + case 0x94: + return 131; + case 0x93: + return 130; + case 0x92: + return 129; + case 0x91: + return 128; + case 0x8F: + return 127; + case 0x8E: + return 126; + case 0x8D: + return 125; + case 0x8C: + return 124; + case 0x8B: + return 123; + case 0x8A: + return 122; + case 0x89: + return 121; + case 0x88: + return 120; + case 0x87: + return 119; + case 0x86: + return 118; + case 0x85: + return 117; + case 0x84: + return 116; + case 0x83: + return 115; + case 0x82: + return 114; + case 0x81: + return 113; + + case 0x7F: + return 112; + case 0x7E: + return 111; + case 0x7D: + return 110; + case 0x7C: + return 109; + case 0x7B: + return 108; + case 0x7A: + return 107; + case 0x79: + return 106; + case 0x78: + return 105; + case 0x77: + return 104; + case 0x76: + return 103; + case 0x75: + return 102; + case 0x74: + return 101; + case 0x73: + return 100; + case 0x72: + return 99; + case 0x71: + return 98; + case 0x6F: + return 97; + case 0x6E: + return 96; + case 0x6D: + return 95; + case 0x6C: + return 94; + case 0x6B: + return 93; + case 0x6A: + return 92; + case 0x69: + return 91; + case 0x68: + return 90; + case 0x67: + return 89; + case 0x66: + return 88; + case 0x65: + return 87; + case 0x64: + return 86; + case 0x63: + return 85; + case 0x62: + return 84; + case 0x61: + return 83; + case 0x5F: + return 82; + case 0x5E: + return 81; + case 0x5D: + return 80; + case 0x5C: + return 79; + case 0x5B: + return 78; + case 0x5A: + return 77; + case 0x59: + return 76; + case 0x58: + return 75; + case 0x57: + return 74; + case 0x56: + return 73; + case 0x55: + return 72; + case 0x54: + return 71; + case 0x53: + return 70; + case 0x52: + return 69; + case 0x51: + return 68; + case 0x4F: + return 67; + case 0x4E: + return 66; + case 0x4D: + return 65; + case 0x4C: + return 64; + case 0x4B: + return 63; + case 0x4A: + return 62; + case 0x49: + return 61; + case 0x48: + return 60; + case 0x47: + return 59; + case 0x46: + return 58; + case 0x45: + return 57; + case 0x44: + return 56; + case 0x43: + return 55; + case 0x42: + return 54; + case 0x41: + return 53; + case 0x3F: + return 52; + case 0x3E: + return 51; + case 0x3D: + return 50; + case 0x3C: + return 49; + case 0x3B: + return 48; + case 0x3A: + return 47; + case 0x39: + return 46; + case 0x38: + return 45; + case 0x37: + return 44; + case 0x36: + return 43; + case 0x35: + return 42; + case 0x34: + return 41; + case 0x33: + return 40; + case 0x32: + return 39; + case 0x31: + return 38; + case 0x29: + return 37; + case 0x28: + return 36; + case 0x27: + return 35; + case 0x26: + return 34; + case 0x25: + return 33; + case 0x24: + return 32; + case 0x23: + return 31; + case 0x22: + return 30; + case 0x21: + return 29; + case 0x1F: + return 28; + case 0x1E: + return 27; + case 0x1D: + return 26; + case 0x1C: + return 25; + case 0x1B: + return 24; + case 0x1A: + return 23; + case 0x19: + return 22; + case 0x18: + return 21; + case 0x17: + return 20; + case 0x16: + return 19; + case 0x15: + return 18; + case 0x14: + return 17; + case 0x13: + return 16; + case 0x12: + return 15; + case 0x11: + return 14; + case 0x0F: + return 13; + case 0x0E: + return 12; + case 0x0D: + return 11; + case 0x0C: + return 10; + case 0x0B: + return 9; + case 0x0A: + return 8; + case 0x09: + return 7; + case 0x08: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x04: + return 2; + case 0x03: + return 1; + default: + return 0; + } +} + +static int crusnwld64(int ffcru64) { + switch (ffcru64) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnwldui(int ffcruui) { + switch (ffcruui) { + + case 0xFF: + return 225; + case 0xFE: + return 224; + case 0xFD: + return 223; + case 0xFC: + return 222; + case 0xFB: + return 221; + case 0xFA: + return 220; + case 0xF9: + return 219; + case 0xF8: + return 218; + case 0xF7: + return 217; + case 0xF6: + return 216; + case 0xF5: + return 215; + case 0xF4: + return 214; + case 0xF3: + return 213; + case 0xF2: + return 212; + case 0xF1: + return 211; + case 0xEF: + return 210; + case 0xEE: + return 209; + case 0xED: + return 208; + case 0xEC: + return 207; + case 0xEB: + return 206; + case 0xEA: + return 205; + case 0xE9: + return 204; + case 0xE8: + return 203; + case 0xE7: + return 202; + case 0xE6: + return 201; + case 0xE5: + return 200; + case 0xE4: + return 199; + case 0xE3: + return 198; + case 0xE2: + return 197; + case 0xE1: + return 196; + case 0xDF: + return 195; + case 0xDE: + return 194; + case 0xDD: + return 193; + case 0xDC: + return 192; + case 0xDB: + return 191; + case 0xDA: + return 190; + case 0xD9: + return 189; + case 0xD8: + return 188; + case 0xD7: + return 187; + case 0xD6: + return 186; + case 0xD5: + return 185; + case 0xD4: + return 184; + case 0xD3: + return 183; + case 0xD2: + return 182; + case 0xD1: + return 181; + case 0xCF: + return 180; + case 0xCE: + return 179; + case 0xCD: + return 178; + case 0xCC: + return 177; + case 0xCB: + return 176; + case 0xCA: + return 175; + case 0xC9: + return 174; + case 0xC7: + return 173; + case 0xC6: + return 172; + case 0xC5: + return 171; + case 0xC3: + return 170; + case 0xBF: + return 169; + case 0xBE: + return 168; + case 0xBD: + return 167; + case 0xBC: + return 166; + case 0xBB: + return 165; + case 0xBA: + return 164; + case 0xB9: + return 163; + case 0xB8: + return 162; + case 0xB7: + return 161; + case 0xB6: + return 160; + case 0xB5: + return 159; + case 0xB4: + return 158; + case 0xB3: + return 157; + case 0xB2: + return 156; + case 0xB1: + return 155; + case 0xAF: + return 154; + case 0xAE: + return 153; + case 0xAD: + return 152; + case 0xAC: + return 151; + case 0xAB: + return 150; + case 0xAA: + return 149; + case 0xA9: + return 148; + case 0xA8: + return 147; + case 0xA7: + return 146; + case 0xA6: + return 145; + case 0xA5: + return 144; + case 0xA4: + return 143; + case 0xA3: + return 142; + case 0xA2: + return 141; + case 0xA1: + return 140; + case 0x9F: + return 139; + case 0x9E: + return 138; + case 0x9D: + return 137; + case 0x9C: + return 136; + case 0x9B: + return 135; + case 0x9A: + return 134; + case 0x99: + return 133; + case 0x98: + return 132; + case 0x97: + return 131; + case 0x96: + return 130; + case 0x95: + return 129; + case 0x94: + return 128; + case 0x93: + return 127; + case 0x92: + return 126; + case 0x91: + return 125; + case 0x8F: + return 124; + case 0x8E: + return 123; + case 0x8D: + return 122; + case 0x8C: + return 121; + case 0x8B: + return 120; + case 0x8A: + return 119; + case 0x89: + return 118; + case 0x88: + return 117; + case 0x87: + return 116; + case 0x86: + return 115; + case 0x85: + return 114; + case 0x84: + return 113; + case 0x83: + return 112; + case 0x82: + return 111; + + + case 0x7E: + return 110; + case 0x7D: + return 109; + case 0x7C: + return 108; + case 0x7B: + return 107; + case 0x7A: + return 106; + case 0x79: + return 105; + case 0x78: + return 104; + case 0x77: + return 103; + case 0x76: + return 102; + case 0x75: + return 101; + case 0x74: + return 100; + case 0x73: + return 99; + case 0x72: + return 98; + case 0x71: + return 97; + case 0x6F: + return 96; + case 0x6E: + return 95; + case 0x6D: + return 94; + case 0x6C: + return 93; + case 0x6B: + return 92; + case 0x6A: + return 91; + case 0x69: + return 90; + case 0x68: + return 89; + case 0x67: + return 88; + case 0x66: + return 87; + case 0x65: + return 86; + case 0x64: + return 85; + case 0x63: + return 84; + case 0x62: + return 83; + case 0x61: + return 82; + case 0x5F: + return 81; + case 0x5E: + return 80; + case 0x5D: + return 79; + case 0x5C: + return 78; + case 0x5B: + return 77; + case 0x5A: + return 76; + case 0x59: + return 75; + case 0x58: + return 74; + case 0x57: + return 73; + case 0x56: + return 72; + case 0x55: + return 71; + case 0x54: + return 70; + case 0x53: + return 69; + case 0x52: + return 68; + case 0x51: + return 67; + case 0x4F: + return 66; + case 0x4E: + return 65; + case 0x4D: + return 64; + case 0x4C: + return 63; + case 0x4B: + return 62; + case 0x4A: + return 61; + case 0x49: + return 60; + case 0x48: + return 59; + case 0x47: + return 58; + case 0x46: + return 57; + case 0x45: + return 56; + case 0x44: + return 55; + case 0x43: + return 54; + case 0x42: + return 53; + case 0x41: + return 52; + case 0x3F: + return 51; + case 0x3E: + return 50; + case 0x3D: + return 49; + case 0x3C: + return 48; + case 0x3B: + return 47; + case 0x3A: + return 46; + case 0x39: + return 45; + case 0x38: + return 44; + case 0x37: + return 43; + case 0x36: + return 42; + case 0x35: + return 41; + case 0x34: + return 40; + case 0x33: + return 39; + case 0x32: + return 38; + case 0x31: + return 37; + case 0x29: + return 36; + case 0x28: + return 35; + case 0x27: + return 34; + case 0x26: + return 33; + case 0x25: + return 32; + case 0x24: + return 31; + case 0x23: + return 30; + case 0x22: + return 29; + case 0x21: + return 28; + case 0x1F: + return 27; + case 0x1E: + return 26; + case 0x1D: + return 25; + case 0x1C: + return 24; + case 0x1B: + return 23; + case 0x1A: + return 22; + case 0x19: + return 21; + case 0x18: + return 20; + case 0x17: + return 19; + case 0x16: + return 18; + case 0x15: + return 17; + case 0x14: + return 16; + case 0x13: + return 15; + case 0x12: + return 14; + case 0x11: + return 13; + case 0x0F: + return 12; + case 0x0E: + return 11; + case 0x0D: + return 10; + case 0x0C: + return 9; + case 0x0B: + return 8; + case 0x0A: + return 7; + case 0x09: + return 6; + case 0x07: + return 5; + case 0x06: + return 4; + case 0x05: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusa64(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int crusnusaui(int ffusa) { + switch (ffusa) { + + case 0xFF: + return 214; + case 0xFE: + return 213; + case 0xFC: + return 212; + case 0xFB: + return 211; + case 0xFA: + return 210; + case 0xF9: + return 209; + case 0xF8: + return 208; + case 0xF7: + return 207; + case 0xF6: + return 206; + case 0xF5: + return 205; + case 0xF4: + return 204; + case 0xF3: + return 203; + case 0xF2: + return 202; + case 0xF1: + return 201; + case 0xEF: + return 200; + case 0xEE: + return 199; + case 0xED: + return 198; + case 0xEC: + return 197; + case 0xEB: + return 196; + case 0xEA: + return 195; + case 0xE9: + return 194; + case 0xE8: + return 193; + case 0xE7: + return 192; + case 0xE6: + return 191; + case 0xE5: + return 190; + case 0xE4: + return 189; + case 0xE3: + return 188; + case 0xE2: + return 187; + case 0xE1: + return 186; + case 0xDF: + return 185; + case 0xDE: + return 184; + case 0xDD: + return 183; + case 0xDC: + return 182; + case 0xDB: + return 181; + case 0xDA: + return 180; + case 0xD9: + return 179; + case 0xD8: + return 178; + case 0xD7: + return 177; + case 0xD3: + return 176; + case 0xD2: + return 175; + case 0xD1: + return 174; + case 0xCF: + return 173; + case 0xCE: + return 172; + case 0xCD: + return 171; + case 0xCC: + return 170; + case 0xCB: + return 169; + case 0xCA: + return 168; + case 0xC9: + return 167; + case 0xC7: + return 166; + case 0xC6: + return 165; + case 0xC5: + return 164; + case 0xC3: + return 163; + case 0xBF: + return 162; + case 0xBE: + return 161; + case 0xBD: + return 160; + case 0xBC: + return 159; + case 0xBB: + return 158; + case 0xBA: + return 157; + case 0xB9: + return 156; + case 0xB8: + return 155; + case 0xB7: + return 154; + case 0xB6: + return 153; + case 0xB5: + return 152; + case 0xB4: + return 151; + case 0xB3: + return 150; + case 0xB2: + return 149; + case 0xB1: + return 148; + case 0xAF: + return 147; + case 0xAE: + return 146; + case 0xAD: + return 145; + case 0xAC: + return 144; + case 0xAB: + return 143; + case 0xAA: + return 142; + case 0xA9: + return 141; + case 0xA8: + return 140; + case 0xA7: + return 139; + case 0xA6: + return 138; + case 0xA5: + return 137; + case 0xA4: + return 136; + case 0xA3: + return 135; + case 0xA2: + return 134; + case 0xA1: + return 133; + case 0x9F: + return 132; + case 0x9E: + return 131; + case 0x9D: + return 130; + case 0x9C: + return 129; + case 0x9B: + return 128; + case 0x9A: + return 127; + case 0x99: + return 126; + case 0x98: + return 125; + case 0x97: + return 124; + case 0x96: + return 123; + case 0x95: + return 122; + case 0x94: + return 121; + case 0x93: + return 120; + case 0x92: + return 119; + case 0x91: + return 118; + case 0x8F: + return 117; + case 0x8E: + return 116; + case 0x8D: + return 115; + case 0x8C: + return 114; + case 0x8B: + return 113; + case 0x8A: + return 112; + case 0x89: + return 111; + case 0x88: + return 110; + case 0x87: + return 109; + case 0x86: + return 108; + case 0x84: + return 107; + case 0x83: + return 106; + case 0x82: + return 105; + + + case 0x7E: + return 104; + case 0x7D: + return 103; + case 0x7C: + return 102; + case 0x7B: + return 101; + case 0x7A: + return 100; + case 0x79: + return 99; + case 0x78: + return 98; + case 0x77: + return 97; + case 0x76: + return 96; + case 0x75: + return 95; + case 0x74: + return 94; + case 0x73: + return 93; + case 0x71: + return 92; + case 0x6F: + return 91; + case 0x6E: + return 90; + case 0x6D: + return 89; + case 0x6C: + return 88; + case 0x6B: + return 87; + case 0x6A: + return 86; + case 0x69: + return 85; + case 0x68: + return 84; + case 0x67: + return 83; + case 0x66: + return 82; + case 0x65: + return 81; + case 0x64: + return 80; + case 0x63: + return 79; + case 0x62: + return 78; + case 0x61: + return 77; + case 0x5F: + return 76; + case 0x5E: + return 75; + case 0x5D: + return 74; + case 0x5C: + return 73; + case 0x5B: + return 72; + case 0x5A: + return 71; + case 0x59: + return 70; + case 0x58: + return 69; + case 0x57: + return 68; + case 0x56: + return 67; + case 0x55: + return 66; + case 0x54: + return 65; + case 0x53: + return 64; + case 0x52: + return 63; + case 0x51: + return 62; + case 0x4F: + return 61; + case 0x4E: + return 60; + case 0x4D: + return 59; + case 0x4C: + return 58; + case 0x4B: + return 57; + case 0x4A: + return 56; + case 0x49: + return 55; + case 0x48: + return 54; + case 0x47: + return 53; + case 0x46: + return 52; + case 0x45: + return 51; + case 0x44: + return 50; + case 0x43: + return 49; + case 0x42: + return 48; + case 0x41: + return 47; + case 0x3F: + return 46; + case 0x3E: + return 45; + case 0x3D: + return 44; + case 0x3B: + return 43; + case 0x3A: + return 42; + case 0x39: + return 41; + case 0x38: + return 40; + case 0x37: + return 39; + case 0x36: + return 38; + case 0x35: + return 37; + case 0x34: + return 36; + case 0x33: + return 35; + case 0x32: + return 34; + case 0x31: + return 33; + case 0x29: + return 32; + case 0x28: + return 31; + case 0x27: + return 30; + case 0x26: + return 29; + case 0x25: + return 28; + case 0x24: + return 27; + case 0x23: + return 26; + case 0x22: + return 25; + case 0x21: + return 24; + case 0x1F: + return 23; + case 0x1E: + return 22; + case 0x1D: + return 21; + case 0x1B: + return 20; + case 0x1A: + return 19; + case 0x19: + return 18; + case 0x18: + return 17; + case 0x17: + return 16; + case 0x16: + return 15; + case 0x15: + return 14; + case 0x14: + return 13; + case 0x13: + return 12; + case 0x12: + return 11; + case 0x11: + return 10; + case 0x0F: + return 9; + case 0x0D: + return 8; + case 0x0C: + return 7; + case 0x0B: + return 6; + case 0x09: + return 5; + case 0x07: + return 4; + case 0x06: + return 3; + case 0x03: + return 2; + case 0x01: + return 1; + default: + return 0; + } +} + +static int raveracer64(int ffRaw64) { + switch (ffRaw64) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +static int raveracerui64(int ffRawui64) { + switch (ffRawui64) { + + //case 0xFE: + //return 128; + case 0x7E: + return 123; + //case 0xBE: + //return 126; + case 0x3E: + return 122; + case 0xDE: + return 121; + case 0x5E: + return 120; + case 0x9E: + return 119; + case 0x1E: + return 118; + case 0xEE: + return 117; + case 0x6E: + return 116; + case 0xAE: + return 115; + case 0xCE: + return 114; + case 0x2E: + return 113; + case 0x4E: + return 112; + case 0x8E: + return 111; + case 0x0E: + return 110; + case 0xF6: + return 109; + case 0x76: + return 108; + case 0xB6: + return 107; + case 0x36: + return 106; + case 0xD6: + return 105; + case 0x56: + return 104; + case 0x96: + return 103; + case 0x16: + return 102; + case 0xE6: + return 101; + case 0x66: + return 100; + case 0xA6: + return 99; + case 0xC6: + return 98; + case 0x26: + return 97; + case 0x46: + return 96; + case 0x86: + return 95; + case 0x06: + return 94; + case 0xFA: + return 93; + case 0x7A: + return 92; + case 0xBA: + return 91; + case 0x3A: + return 90; + case 0xDA: + return 89; + case 0x5A: + return 88; + case 0x9A: + return 87; + case 0x1A: + return 86; + case 0xEA: + return 85; + case 0x6A: + return 84; + case 0xAA: + return 83; + case 0xCA: + return 82; + case 0x2A: + return 81; + case 0x4A: + return 80; + case 0x8A: + return 79; + case 0x0A: + return 78; + case 0xF2: + return 77; + case 0x72: + return 76; + case 0xB2: + return 75; + case 0x32: + return 74; + case 0xD2: + return 73; + case 0x52: + return 72; + case 0x92: + return 71; + case 0x12: + return 70; + case 0xE2: + return 69; + case 0x62: + return 68; + case 0xA2: + return 67; + case 0xC2: + return 66; + case 0x22: + return 65; + case 0x42: + return 64; + case 0x82: + return 63; + case 0x02: + return 62; + + + case 0x80: + return 61; + case 0x40: + return 60; + case 0x20: + return 59; + case 0xC0: + return 58; + case 0xA0: + return 57; + case 0x60: + return 56; + case 0xE0: + return 55; + case 0x10: + return 54; + case 0x90: + return 53; + case 0x50: + return 52; + case 0xD0: + return 51; + case 0x30: + return 50; + case 0xB0: + return 49; + case 0x70: + return 48; + case 0xF0: + return 47; + case 0x08: + return 46; + case 0x88: + return 45; + case 0x48: + return 44; + case 0x28: + return 43; + case 0xC8: + return 42; + case 0xA8: + return 41; + case 0x68: + return 40; + case 0xE8: + return 39; + case 0x18: + return 38; + case 0x98: + return 37; + case 0x58: + return 36; + case 0xD8: + return 35; + case 0x38: + return 34; + case 0xB8: + return 33; + case 0x78: + return 32; + case 0xF8: + return 31; + case 0x04: + return 30; + case 0x84: + return 29; + case 0x44: + return 28; + case 0x24: + return 27; + case 0xC4: + return 26; + case 0xA4: + return 25; + case 0x64: + return 24; + case 0xE4: + return 23; + case 0x14: + return 22; + case 0x94: + return 21; + case 0x54: + return 20; + case 0xD4: + return 19; + case 0x34: + return 18; + case 0xB4: + return 17; + case 0x74: + return 16; + case 0xF4: + return 15; + case 0x0C: + return 14; + case 0x8C: + return 13; + case 0x4C: + return 12; + case 0x2C: + return 11; + case 0xCC: + return 10; + case 0xAC: + return 9; + case 0x6C: + return 8; + case 0xEC: + return 7; + case 0x1C: + return 6; + case 0x9C: + return 5; + case 0x5C: + return 4; + case 0xDC: + return 3; + case 0x3C: + return 2; + //case 0xBC: + //return 3; + case 0x7C: + return 1; + //case 0xFC: + //return 1; + } +} + +void Mame020664bit::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) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x540, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049364 + 0x7FC, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x7F0, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x48, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x62C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x540, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x68, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x5A0, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x8, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit mameui + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + else if (hWnd1 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x540, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x68, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x5A0, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x8, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit mameui + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + else if (hWnd2 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x540, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x68, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x5A0, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x8, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit mameui + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd3 > NULL) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x540, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049364 + 0x7FC, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x7F0, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x48, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x62C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + else if (hWnd7 > NULL) + { + int ffsanfranrush64 = 0; + int ffsanfranrush64ui = 0; + { + INT_PTR ff64 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff164 = helpers->ReadIntPtr(ff64 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264 = helpers->ReadIntPtr(ff164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364 = helpers->ReadIntPtr(ff264 + 0x540, /* isRelativeOffset*/ false); + INT_PTR ff464 = helpers->ReadIntPtr(ff364 + 0x68, /* isRelativeOffset*/ false); + UINT8 ffsan64 = helpers->ReadByte(ff464 + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit + INT_PTR ff64ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff164ui = helpers->ReadIntPtr(ff64ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff264ui = helpers->ReadIntPtr(ff164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff364ui = helpers->ReadIntPtr(ff264ui + 0x5A0, /* isRelativeOffset*/ false); + INT_PTR ff464ui = helpers->ReadIntPtr(ff364ui + 0x8, /* isRelativeOffset*/ false); + UINT8 ffsan64ui = helpers->ReadByte(ff464ui + 0x7DC, /* isRelativeOffset */ false); //SanFranRush64bit mameui + std::string ffs1 = std::to_string(ffsan64); + std::string ffs2 = std::to_string(ffsan64ui); + helpers->log((char *)ffs1.c_str()); + helpers->log("got value: "); + ffsanfranrush64 = sanfran64(ffsan64); + ffsanfranrush64ui = sanfran64ui(ffsan64ui); + + if (FFBMode == 0) + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffsanfranrush64 > 112) & (ffsanfranrush64 < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64 > 0) & (ffsanfranrush64 < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 112) & (ffsanfranrush64ui < 233)) + { + helpers->log("moving wheel left"); + double percentForce = (233 - ffsanfranrush64ui) / 119.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffsanfranrush64ui > 0) & (ffsanfranrush64ui < 114)) + { + helpers->log("moving wheel right"); + double percentForce = (ffsanfranrush64ui) / 112.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd4 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x28, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave643 + 0x40, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x2D8, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x630, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x40, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + + if (hWnd5 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x28, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave643 + 0x40, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x2D8, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x630, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x40, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd6 > NULL) + { + int ffrave64 = 0; + int ffraveui64 = 0; + { + INT_PTR ffrave640 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffrave641 = helpers->ReadIntPtr(ffrave640 + 0x2E8, /* isRelativeOffset*/ false); + INT_PTR ffrave642 = helpers->ReadIntPtr(ffrave641 + 0x28, /* isRelativeOffset*/ false); + INT_PTR ffrave643 = helpers->ReadIntPtr(ffrave642 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffRaw64 = helpers->ReadByte(ffrave643 + 0x40, /* isRelativeOffset */ false); //Rave Racer 64bit + INT_PTR ffraveui640 = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffraveui641 = helpers->ReadIntPtr(ffraveui640 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffraveui642 = helpers->ReadIntPtr(ffraveui641 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffraveui643 = helpers->ReadIntPtr(ffraveui642 + 0x2D8, /* isRelativeOffset*/ false); + INT_PTR ffraveui644 = helpers->ReadIntPtr(ffraveui643 + 0x630, /* isRelativeOffset*/ false); + UINT8 ffRawui64 = helpers->ReadByte(ffraveui644 + 0x40, /* isRelativeOffset */ false); //Rave Racer mameui 64bit + ffrave64 = raveracer64(ffRaw64); + ffraveui64 = raveracerui64(ffRawui64); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffrave64); + std::string ffs2 = std::to_string(ffraveui64); + helpers->log((char *)ffs1.c_str()); + } + if (FFBMode == 0) + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else + { + if ((ffrave64 > 61) && (ffrave64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffrave64 > 0) && (ffrave64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffrave64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 61) && (ffraveui64 < 124)) + { + helpers->log("moving wheel right"); + double percentForce = (124 - ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffraveui64 > 0) && (ffraveui64 < 62)) + { + helpers->log("moving wheel left"); + double percentForce = (ffraveui64) / 61.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd8 > NULL) + { + INT_PTR ff204964 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ff2049164 = helpers->ReadIntPtr(ff204964 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264 = helpers->ReadIntPtr(ff2049164 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364 = helpers->ReadIntPtr(ff2049264 + 0x540, /* isRelativeOffset*/ false); + UINT8 ff2049564 = helpers->ReadByte(ff2049364 + 0x7FC, /* isRelativeOffset */ false); //SanFranRush204964bit + INT_PTR ff204964ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ff2049164ui = helpers->ReadIntPtr(ff204964ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ff2049264ui = helpers->ReadIntPtr(ff2049164ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ff2049364ui = helpers->ReadIntPtr(ff2049264ui + 0x7F0, /* isRelativeOffset*/ false); + INT_PTR ff2049464ui = helpers->ReadIntPtr(ff2049364ui + 0x48, /* isRelativeOffset*/ false); + UINT8 ff2049564ui = helpers->ReadByte(ff2049464ui + 0x62C, /* isRelativeOffset */ false); //SanFranRush204964bitmameUI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ff2049564); + std::string ffs2 = std::to_string(ff2049564ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ff2049564 > 0x80) & (ff2049564 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564 > 0x00) & (ff2049564 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x80) & (ff2049564ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ff2049564ui > 0x00) & (ff2049564ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ff2049564ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd9 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x570, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal464 + 0x7E4, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x5A0, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal464ui + 0x7B4, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd10 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x570, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal464 + 0x7E4, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x5A0, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal464ui + 0x7B4, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd11 > NULL) + { + INT_PTR ffcal164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcal264 = helpers->ReadIntPtr(ffcal164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364 = helpers->ReadIntPtr(ffcal264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464 = helpers->ReadIntPtr(ffcal364 + 0x570, /* isRelativeOffset*/ false); + UINT8 ffcal664 = helpers->ReadByte(ffcal464 + 0x7E4, /* isRelativeOffset */ false); //CaliforniaSpeed64bit + INT_PTR ffcal164ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcal264ui = helpers->ReadIntPtr(ffcal164ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcal364ui = helpers->ReadIntPtr(ffcal264ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcal464ui = helpers->ReadIntPtr(ffcal364ui + 0x5A0, /* isRelativeOffset*/ false); + UINT8 ffcal664ui = helpers->ReadByte(ffcal464ui + 0x7B4, /* isRelativeOffset */ false); //CaliforniaSpeedMameUI64 + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcal664); + std::string ffs2 = std::to_string(ffcal664ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcal664 > 0x80) & (ffcal664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664 > 0x00) & (ffcal664 < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x80) & (ffcal664ui < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcal664ui > 0x00) & (ffcal664ui < 0x80)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcal664ui) / 126.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd12 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd13 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd14 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd15 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd16 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd17 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd18 > NULL) + { + int ffcrusnwld64 = 0; + int ffcrusnwldui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnwld64 = crusnwld64(ffcru664); + ffcrusnwldui = crusnwldui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnwld64 > 110) & (ffcrusnwld64 < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwld64) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwld64 > 0) & (ffcrusnwld64 < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwld64) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 110) & (ffcrusnwldui < 226)) + { + helpers->log("moving wheel left"); + double percentForce = (225 - ffcrusnwldui) / 114.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnwldui > 0) & (ffcrusnwldui < 111)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnwldui) / 110.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd19 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd20 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd21 > NULL) + { + int ffcrusnusa64 = 0; + int ffcrusnusaui = 0; + { + INT_PTR ffcru164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffcru264 = helpers->ReadIntPtr(ffcru164 + 0xB8, /* isRelativeOffset*/ false); + INT_PTR ffcru364 = helpers->ReadIntPtr(ffcru264 + 0x8, /* isRelativeOffset*/ false); + INT_PTR ffcru464 = helpers->ReadIntPtr(ffcru364 + 0x0, /* isRelativeOffset*/ false); + INT_PTR ffcru564 = helpers->ReadIntPtr(ffcru464 + 0x0, /* isRelativeOffset*/ false); + UINT8 ffcru664 = helpers->ReadByte(ffcru564 + 0x54, /* isRelativeOffset */ false); //CrusnWld64bit + INT_PTR ffcru1ui = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffcru2ui = helpers->ReadIntPtr(ffcru1ui + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffcru3ui = helpers->ReadIntPtr(ffcru2ui + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffcru4ui = helpers->ReadIntPtr(ffcru3ui + 0x10, /* isRelativeOffset*/ false); + INT_PTR ffcru5ui = helpers->ReadIntPtr(ffcru4ui + 0x2B8, /* isRelativeOffset*/ false); + UINT8 ffcru6ui = helpers->ReadByte(ffcru5ui + 0x7A4, /* isRelativeOffset */ false); //CrusnWldUI64 + ffcrusnusa64 = crusnusa64(ffcru664); + ffcrusnusaui = crusnusaui(ffcru6ui); + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffcru664); + std::string ffs2 = std::to_string(ffcru6ui); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffcrusnusa64 > 104) & (ffcrusnusa64 < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusa64) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusa64 > 0) & (ffcrusnusa64 < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusa64) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 104) & (ffcrusnusaui < 215)) + { + helpers->log("moving wheel left"); + double percentForce = (214 - ffcrusnusaui) / 109.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffcrusnusaui > 0) & (ffcrusnusaui < 105)) + { + helpers->log("moving wheel right"); + double percentForce = (ffcrusnusaui) / 104.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + } + if (hWnd22 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x120, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x1A8, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x7A4, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x588, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff464UI + 0x4CC, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd23 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x120, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x1A8, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x7A4, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x588, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff464UI + 0x4CC, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd24 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x120, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x1A8, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x7A4, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x588, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff464UI + 0x4CC, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd25 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x120, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x1A8, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x7A4, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x588, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff464UI + 0x4CC, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } + if (hWnd26 > NULL) + { + INT_PTR ffoff164 = helpers->ReadIntPtr(0x0E198068, /* isRelativeOffset*/ true); + INT_PTR ffoff264 = helpers->ReadIntPtr(ffoff164 + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364 = helpers->ReadIntPtr(ffoff264 + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464 = helpers->ReadIntPtr(ffoff364 + 0x120, /* isRelativeOffset*/ false); + INT_PTR ffoff564 = helpers->ReadIntPtr(ffoff464 + 0x1A8, /* isRelativeOffset*/ false); + UINT8 ffoff664 = helpers->ReadByte(ffoff564 + 0x7A4, /* isRelativeOffset */ false); //OffRoadChallenge64bit + INT_PTR ffoff164UI = helpers->ReadIntPtr(0x0DBCF058, /* isRelativeOffset*/ true); + INT_PTR ffoff264UI = helpers->ReadIntPtr(ffoff164UI + 0x48, /* isRelativeOffset*/ false); + INT_PTR ffoff364UI = helpers->ReadIntPtr(ffoff264UI + 0x40, /* isRelativeOffset*/ false); + INT_PTR ffoff464UI = helpers->ReadIntPtr(ffoff364UI + 0x588, /* isRelativeOffset*/ false); + UINT8 ffoff664UI = helpers->ReadByte(ffoff464UI + 0x4CC, /* isRelativeOffset */ false); //OffRoadChallenge64UI + helpers->log("got value: "); + std::string ffs1 = std::to_string(ffoff664); + std::string ffs2 = std::to_string(ffoff664UI); + helpers->log((char *)ffs1.c_str()); + + if (FFBMode == 0) + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + else + { + if ((ffoff664 > 0x83) & (ffoff664 < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664 > 0x00) & (ffoff664 < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x83) & (ffoff664UI < 0x100)) + { + helpers->log("moving wheel left"); + double percentForce = (255 - ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((ffoff664UI > 0x00) & (ffoff664UI < 0x7D)) + { + helpers->log("moving wheel right"); + double percentForce = (ffoff664UI) / 124.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + } +} + diff --git a/Game Files/Mame020664bit.h b/Game Files/Mame020664bit.h new file mode 100644 index 0000000..ae10d9d --- /dev/null +++ b/Game Files/Mame020664bit.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class Mame020664bit : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/MarioKartGPDX.cpp b/Game Files/MarioKartGPDX.cpp new file mode 100644 index 0000000..abbc273 --- /dev/null +++ b/Game Files/MarioKartGPDX.cpp @@ -0,0 +1,105 @@ +#include +#include "MarioKartGPDX.h" + +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: "); + + + // 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); + triggers->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(180, 150, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/MarioKartGPDX.h b/Game Files/MarioKartGPDX.h new file mode 100644 index 0000000..e43a167 --- /dev/null +++ b/Game Files/MarioKartGPDX.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class MarioKartGPDX100 : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/MarioKartGPDX1.10.cpp b/Game Files/MarioKartGPDX1.10.cpp new file mode 100644 index 0000000..475e164 --- /dev/null +++ b/Game Files/MarioKartGPDX1.10.cpp @@ -0,0 +1,230 @@ +#include +#include "MarioKartGPDX1.10.h" + +void MarioKartGPDX110::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int ConstantEffectForSteering = GetPrivateProfileInt(TEXT("Settings"), TEXT("ConstantEffectForSteering"), 0, settingsFilename); + int ConstantEffectForSteeringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ConstantEffectForSteeringStrength"), 0, settingsFilename); + int WeaponRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("WeaponRumble"), 0, settingsFilename); + int WeaponRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("WeaponRumbleStrength"), 0, settingsFilename); + int CoinRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("CoinRumble"), 0, settingsFilename); + int CoinRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("CoinRumbleStrength"), 0, settingsFilename); + int DriftRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("DriftRumble"), 0, settingsFilename); + int DriftRumbleControllerStrengthMultiplier = GetPrivateProfileInt(TEXT("Settings"), TEXT("DriftRumbleControllerStrengthMultiplier"), 0, settingsFilename); + int HitGroundRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("HitGroundRumble"), 0, settingsFilename); + int HitGroundRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("HitGroundRumbleStrength"), 0, settingsFilename); + int BoostRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("BoostRumble"), 0, settingsFilename); + int BoostRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("BoostRumbleStrength"), 0, settingsFilename); + int MainShakeRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("MainShakeRumble"), 0, settingsFilename); + int MainShakeRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("MainShakeRumbleStrength"), 0, settingsFilename); + int DirtRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("DirtRumble"), 0, settingsFilename); + int DirtRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("DirtRumbleStrength"), 0, settingsFilename); + int GrassRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("GrassRumble"), 0, settingsFilename); + int GrassRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GrassRumbleStrength"), 0, settingsFilename); + int SandRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("SandRumble"), 0, settingsFilename); + int SandRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SandRumbleStrength"), 0, settingsFilename); + int WaterRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("WaterRumble"), 0, settingsFilename); + int WaterRumbleWheelStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("WaterRumbleWheelStrength"), 0, settingsFilename); + int WaterRumbleControllerStrengthMultiplier = GetPrivateProfileInt(TEXT("Settings"), TEXT("WaterRumbleControllerStrengthMultiplier"), 0, settingsFilename); + int TileRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("TileRumble"), 0, settingsFilename); + int TileRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("TileRumbleStrength"), 0, settingsFilename); + int CarpetRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("CarpetRumble"), 0, settingsFilename); + int CarpetRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("CarpetRumbleStrength"), 0, settingsFilename); + int SpeedBumpRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("SmallBumpRumble"), 0, settingsFilename); + int SpeedBumpRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SmallBumpRumbleStrength"), 0, settingsFilename); + int RoughTrackRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("RoughTrackRumble"), 0, settingsFilename); + int RoughTrackRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RoughTrackRumbleStrength"), 0, settingsFilename); + int BridgeRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("BridgeRumble"), 0, settingsFilename); + int BridgeRumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("BridgeRumbleStrength"), 0, settingsFilename); + + int ff1 = helpers->ReadInt32(0xA46974, /* isRelativeOffset */ true); //shake + int ff2 = helpers->ReadInt32(0x00A416E4,/* isRelativeOffset */ true); + int ff3 = helpers->ReadInt32(ff2 + 0x628, /* isRelativeOffset */ false); // terrain data + int Gas = helpers->ReadInt32(0xA455C0, /* isRelativeOffset */ true); //0-255 accl + int ff5 = helpers->ReadInt32(ff2 + 0x658, /* isRelativeOffset */ false); //kart flying or on ground + int ff6 = helpers->ReadInt32(0x00A309A0,/* isRelativeOffset */ true); + int ff7 = helpers->ReadInt32(ff6 + 0x304, /* isRelativeOffset */ false); + int ff8 = helpers->ReadInt32(ff7 + 0xE8, /* isRelativeOffset */ false); + int ff9 = helpers->ReadInt32(ff8 + 0x64, /* isRelativeOffset */ false); + int ff10 = helpers->ReadInt32(ff9 + 0x38, /* isRelativeOffset */ false); + int ff11 = helpers->ReadInt32(ff10 + 0x4C4, /* isRelativeOffset */ false); // 1 during race only + float Speed = helpers->ReadFloat32(ff2 + 0x558, /* isRelativeOffset */ false); //Speed of Kart + UINT8 ff13 = helpers->ReadByte(0xA39690, /* isRelativeOffset */ true); //picking up coins + UINT8 ff14 = helpers->ReadByte(0xA4528D, /* isRelativeOffset */ true); //picking up weapon box + UINT8 Wheel = helpers->ReadByte(0xA4652D, /* isRelativeOffset */ true); //0-255 steering + INT_PTR ff16 = helpers->ReadIntPtr(0x00A2E284, /* isRelativeOffset*/ true); + UINT8 ff17 = helpers->ReadByte(ff2 + 0x674, /* isRelativeOffset */ false); // Drift + UINT8 ff18 = helpers->ReadByte(ff16 + 0x3A4, /* isRelativeOffset */ false); // Boost + + int static oldcoins = 0; + int newcoins = ff13; + 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)) + { + if ((Wheel >= 0) & (Wheel < 128)) + { + double percentForce = ((128 - Wheel) / (ConstantEffectForSteeringStrength / 1.0)); + double percentLength = 100; + triggers->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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); + double percentLength = (200); + triggers->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(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->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(180, 150, 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 new file mode 100644 index 0000000..c6f2231 --- /dev/null +++ b/Game Files/MarioKartGPDX1.10.h @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 0000000..4a31e6c --- /dev/null +++ b/Game Files/OutRun2Fake.cpp @@ -0,0 +1,462 @@ +#include +#include "Outrun2Fake.h" + +void OutRun2Fake::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + int ff = helpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false); + int ffwall = helpers->ReadInt32(0x08273FAC, /* isRelativeOffset */ false); + float ffspeed = helpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo + int ff3 = helpers->ReadInt32(0x0827A1DA, /* isRelativeOffset */ false); + int ff4 = helpers->ReadInt32(0x0827A35D, /* isRelativeOffset */ false); + int ff5 = helpers->ReadInt32(0x0827A1D4, /* isRelativeOffset */ false); + UINT8 ff6 = helpers->ReadByte(0x08670DC8, /* isRelativeOffset */ false); // steering + float ff7 = helpers->ReadFloat32(0x08273AD4, /* isRelativeOffset */ false); + UINT8 ff8 = helpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race + UINT8 ff9 = helpers->ReadByte(0x086749CA, /* isRelativeOffset */ false); // 1 when menu + + helpers->log("got value: "); + std::string ffs = std::to_string(ff); + helpers->log((char *)ffs.c_str()); + + int static oldFloat = 0.0; + int newFloat = ff3; + int static oldFloat1 = 0.0; + int newFloat1 = ff4; + if (FFBMode == 1) + { + if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff8 == 1)) + { + double percentForce = ((127 - ff6) / 127.0); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff8 == 1)) + { + double percentForce = ((ff6 - 127) / 128.0); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff9 == 1)) + { + double percentForce = ((127 - ff6) / 127.0); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff9 == 1)) + { + double percentForce = ((ff6 - 127) / 128.0); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 2)) + { + double percentForce = (0.1); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 2)) + { + double percentForce = (0.2); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 2)) + { + double percentForce = (0.3); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 2)) + { + double percentForce = (0.4); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 2)) + { + double percentForce = (0.5); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 2)) + { + double percentForce = (0.6); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 2)) + { + double percentForce = (0.7); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 2)) + { + double percentForce = (0.8); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 2)) + { + double percentForce = (0.9); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 2)) + { + double percentForce = (1.0); + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 1)) + { + double percentForce = (0.1); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 1)) + { + double percentForce = (0.2); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 1)) + { + double percentForce = (0.3); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 1)) + { + double percentForce = (0.4); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 1)) + { + double percentForce = (0.5); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 1)) + { + double percentForce = (0.6); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 1)) + { + double percentForce = (0.7); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 1)) + { + double percentForce = (0.8); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 1)) + { + double percentForce = (0.9); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 1)) + { + double percentForce = (1.0); + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + } + else + { + if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff8 == 1) & (FFBMode == 0)) + { + double percentForce = ((127 - ff6) / 127.0); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff8 == 1)) + { + double percentForce = ((ff6 - 127) / 128.0); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + if ((ff6 >= 0x00) & (ff6 < 0x7F) & (ff9 == 1)) + { + double percentForce = ((127 - ff6) / 127.0); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + if ((ff6 > 0x7F) & (ff6 < 0x100) & (ff9 == 1)) + { + double percentForce = ((ff6 - 127) / 128.0); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 2)) + { + double percentForce = (0.1); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 2)) + { + double percentForce = (0.2); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 2)) + { + double percentForce = (0.3); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 2)) + { + double percentForce = (0.4); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 2)) + { + double percentForce = (0.5); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 2)) + { + double percentForce = (0.6); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 2)) + { + double percentForce = (0.7); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 2)) + { + double percentForce = (0.8); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 2)) + { + double percentForce = (0.9); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 2)) + { + double percentForce = (1.0); + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 0.1) & (ffspeed <= 80) & (ff5 == 1)) + { + double percentForce = (0.1); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 80.1) & (ffspeed <= 130) & (ff5 == 1)) + { + double percentForce = (0.2); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 130.1) & (ffspeed <= 180) & (ff5 == 1)) + { + double percentForce = (0.3); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 180.1) & (ffspeed <= 220) & (ff5 == 1)) + { + double percentForce = (0.4); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 220.1) & (ffspeed <= 270) & (ff5 == 1)) + { + double percentForce = (0.5); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 270.1) & (ffspeed <= 320) & (ff5 == 1)) + { + double percentForce = (0.6); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 320.1) & (ffspeed <= 380) & (ff5 == 1)) + { + double percentForce = (0.7); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 380.1) & (ffspeed <= 430) & (ff5 == 1)) + { + double percentForce = (0.8); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 430.1) & (ffspeed <= 500) & (ff5 == 1)) + { + double percentForce = (0.9); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((oldFloat != newFloat) & (ffspeed >= 500.1) & (ffspeed <= 1000) & (ff5 == 1)) + { + double percentForce = (1.0); + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + } + + if ((oldFloat1 != newFloat1) & (ffspeed >= 0.1) & (ffspeed <= 50)) + { + double percentForce = (0.1); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 50.1) & (ffspeed <= 100)) + { + double percentForce = (0.2); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 100.1) & (ffspeed <= 150)) + { + double percentForce = (0.3); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 150.1) & (ffspeed <= 200)) + { + double percentForce = (0.4); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 200.1) & (ffspeed <= 250)) + { + double percentForce = (0.5); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 250.1) & (ffspeed <= 300)) + { + double percentForce = (0.6); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 300.1) & (ffspeed <= 350)) + { + double percentForce = (0.7); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 350.1) & (ffspeed <= 400)) + { + double percentForce = (0.8); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 450.1) & (ffspeed <= 500)) + { + double percentForce = (0.9); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((oldFloat1 != newFloat1) & (ffspeed >= 500.1) & (ffspeed <= 1000)) + { + double percentForce = (1.0); + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(200, 200, percentForce); + } + else if ((ff == 8) & (ffspeed >= 0.1) & (ffspeed <= 1000)) + { + double percentForce = 0.1; + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(70, 70, percentForce); + } + else if ((ff == 4) & (ffspeed >= 0.1) & (ffspeed <= 1000)) + { + double percentForce = 0.2; + double percentLength = 50; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(50, 50, percentForce); + } + else if ((ff == 16) & (ffspeed >= 0.1) & (ffspeed <= 1000)) + { + double percentForce = 0.2; + double percentLength = 50; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(100, 50, percentForce); + } + oldFloat = newFloat; + oldFloat1 = newFloat1; +} \ No newline at end of file diff --git a/Game Files/OutRun2Fake.h b/Game Files/OutRun2Fake.h new file mode 100644 index 0000000..ed3a295 --- /dev/null +++ b/Game Files/OutRun2Fake.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class OutRun2Fake : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/OutRun2Real.cpp b/Game Files/OutRun2Real.cpp new file mode 100644 index 0000000..63e1d36 --- /dev/null +++ b/Game Files/OutRun2Real.cpp @@ -0,0 +1,62 @@ +#include +#include "Outrun2Real.h" +EffectTriggers* myTriggers; +EffectConstants *myConstants; +Helpers *myHelpers; + +void SendForceFeedback(__int8 force) +{ + if (force >= 1 && force <= 0x0F) + { + // direction from right => makes wheel turn left + double percentForce = (16 - force) / 15.0; + double percentLength = 100; + //myHelpers->log("got value: "); + //std::string ffs = std::to_string(force); + //myHelpers->log((char *)ffs.c_str()); + myTriggers->LeftRight(0, percentForce, percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce); + } + else if (force >= 0x10 && force <= 0x1E) + { + // direction from left => makes wheel turn right + double percentForce = (31 - force) / 15.0; + double percentLength = 100; + //myHelpers->log("got value: "); + //std::string ffs = std::to_string(force); + //myHelpers->log((char *)ffs.c_str()); + myTriggers->LeftRight(percentForce, 0, percentLength); + myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce); + } +} + +signed int cdecl or2FfbFunction(unsigned __int8 unk1, unsigned __int8 unk2, unsigned __int8 force, char unk3) +{ + if (unk1 == 0x7D) + { + // not used afaik + } + if (unk1 == 0x7B) + { + SendForceFeedback(force); + } + + return 0; +} + +void OutRun2Real::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + bool init = false; + if (!init) + { + DWORD tempdw = 0x08105A48; + DWORD cock = (DWORD)(void *)or2FfbFunction; + DWORD tempdw2 = cock - tempdw - 5; + *(BYTE *)tempdw = 0xE9; + *(DWORD *)(tempdw + 1) = tempdw2; + init = true; + } + + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; +} \ No newline at end of file diff --git a/Game Files/OutRun2Real.h b/Game Files/OutRun2Real.h new file mode 100644 index 0000000..0866c30 --- /dev/null +++ b/Game Files/OutRun2Real.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" + +class OutRun2Real : public Game { +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/PokkenTournament.cpp b/Game Files/PokkenTournament.cpp new file mode 100644 index 0000000..86f3291 --- /dev/null +++ b/Game Files/PokkenTournament.cpp @@ -0,0 +1,51 @@ +#include +#include "PokkenTournament.h" + +void PokkenTournament::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + + INT_PTR ffAddress = helpers->ReadIntPtr(0x00E97F10, /* isRelativeOffset*/ true); + INT_PTR ff1 = helpers->ReadIntPtr(ffAddress + 0x60, /* isRelativeOffset */ false); + INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x8, /* isRelativeOffset */ false); + float ff3 = helpers->ReadFloat32(ff2 + 0xCC, /* isRelativeOffset */ false); //health + INT_PTR ffAddress4 = helpers->ReadIntPtr(0x00EC4C20, /* isRelativeOffset*/ true); + INT_PTR ff5 = helpers->ReadIntPtr(ffAddress4 + 0x60, /* isRelativeOffset */ false); + INT_PTR ff6 = helpers->ReadIntPtr(ff5 + 0x120, /* isRelativeOffset */ false); + INT_PTR ff7 = helpers->ReadIntPtr(ff6 + 0x698, /* isRelativeOffset */ false); //1 during battle except for first startup + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename); + int RumbleLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleLength"), 0, settingsFilename); + int HowtoRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumble"), 0, settingsFilename); + + 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)) + { + if (HowtoRumble == 0) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, percentForce, percentLength); + } + else if (HowtoRumble == 1) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(0, percentForce, percentLength); + } + else if (HowtoRumble == 2) + { + double percentForce = ((RumbleStrength) / 100.0); + double percentLength = (RumbleLength); + triggers->LeftRight(percentForce, 0, percentLength); + } + } + oldFloat = newFloat; +} \ No newline at end of file diff --git a/Game Files/PokkenTournament.h b/Game Files/PokkenTournament.h new file mode 100644 index 0000000..9ab56ab --- /dev/null +++ b/Game Files/PokkenTournament.h @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 0000000..0ce8536 --- /dev/null +++ b/Game Files/RoadFighters3D.cpp @@ -0,0 +1,1226 @@ +#include +#include "SDL.h" +#include "RoadFighters3D.h" +#include +extern HINSTANCE gl_hjgtDll; +extern HINSTANCE gl_hlibavs; +extern int joystick_index1; +extern int joystick_index2; +extern SDL_Joystick* GameController2; + +void RoadFighters3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); + int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename); + int InputDeviceWheelSteeringAxis = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelSteeringAxis"), 0, settingsFilename); + int InputDeviceWheelAcclAxis = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelAcclAxis"), 0, settingsFilename); + int InputDeviceWheelBrakeAxis = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelBrakeAxis"), 0, settingsFilename); + int InputDeviceWheelReverseAxis = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelReverseAxis"), 0, settingsFilename); + int InputDeviceCombinedPedals = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceCombinedPedals"), 0, settingsFilename); + int SteeringDeadzone = GetPrivateProfileInt(TEXT("Settings"), TEXT("SteeringDeadzone"), 0, settingsFilename); + int PedalDeadzone = GetPrivateProfileInt(TEXT("Settings"), TEXT("PedalDeadzone"), 0, settingsFilename); + int SequentialGears = GetPrivateProfileInt(TEXT("Settings"), TEXT("SequentialGears"), 0, settingsFilename); + int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename); + int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename); + int ShowAxisForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowAxisForSetup"), 0, settingsFilename); + int ExitButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ExitButton"), 0, settingsFilename); + int TestButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("TestButton"), 0, settingsFilename); + int ServiceButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ServiceButton"), 0, settingsFilename); + int CreditButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("CreditButton"), 0, settingsFilename); + int ViewButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ViewButton"), 0, settingsFilename); + int ThreeDimensionalButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ThreeDimensionalButton"), 0, settingsFilename); + int leverUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverUp"), 0, settingsFilename); + int leverDown = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverDown"), 0, settingsFilename); + int leverLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverLeft"), 0, settingsFilename); + int leverRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverRight"), 0, settingsFilename); + int ExitButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ExitButtonDevice2"), 0, settingsFilename); + int TestButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("TestButtonDevice2"), 0, settingsFilename); + int ServiceButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ServiceButtonDevice2"), 0, settingsFilename); + int CreditButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("CreditButtonDevice2"), 0, settingsFilename); + int ViewButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ViewButtonDevice2"), 0, settingsFilename); + int ThreeDimensionalButtonDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ThreeDimensionalButtonDevice2"), 0, settingsFilename); + int leverUpDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverUpDevice2"), 0, settingsFilename); + int leverDownDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverDownDevice2"), 0, settingsFilename); + int leverLeftDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverLeftDevice2"), 0, settingsFilename); + int leverRightDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverRightDevice2"), 0, settingsFilename); + + if (InputDeviceWheelEnable == 1) + { + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D84B, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D84C, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D84D, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D852, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D853, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D854, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D85C, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D85D, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D85E, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA89, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA8A, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA8B, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA8C, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA8D, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18DA8E, false); + + // Dpad stuff here to set as any button + char DpadUpChar[256]; + char DpadDownChar[256]; + char DpadLeftChar[256]; + char DpadRightChar[256]; + char DpadUpCharDevice2[256]; + char DpadDownCharDevice2[256]; + char DpadLeftCharDevice2[256]; + char DpadRightCharDevice2[256]; + GetPrivateProfileStringA("Settings", "DpadUp", "", DpadUpChar, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadDown", "", DpadDownChar, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadLeft", "", DpadLeftChar, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadRight", "", DpadRightChar, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadUpDevice2", "", DpadUpCharDevice2, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadDownDevice2", "", DpadDownCharDevice2, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadLeftDevice2", "", DpadLeftCharDevice2, 256, ".\\FFBplugin.ini"); + GetPrivateProfileStringA("Settings", "DpadRightDevice2", "", DpadRightCharDevice2, 256, ".\\FFBplugin.ini"); + std::string exit("ExitButton"); + std::string test("TestButton"); + std::string service("ServiceButton"); + std::string coin("CoinButton"); + std::string view("ViewButton"); + std::string three("ThreeDimensionalButton"); + std::string lvup("leverUp"); + std::string lvdown("leverDown"); + std::string lvleft("leverLeft"); + std::string lvright("leverRight"); + std::string exit2("ExitButtonDevice2"); + std::string test2("TestButtonDevice2"); + std::string service2("ServiceButtonDevice2"); + std::string coin2("CoinButtonDevice2"); + std::string view2("ViewButtonDevice2"); + std::string three2("ThreeDimensionalButtonDevice2"); + std::string lvup2("leverUpDevice2"); + std::string lvdown2("leverDownDevice2"); + std::string lvleft2("leverLeftDevice2"); + std::string lvright2("leverRightDevice2"); + std::string dpdup(DpadUpChar); + std::string dpddown(DpadDownChar); + std::string dpdleft(DpadLeftChar); + std::string dpdright(DpadRightChar); + std::string dpdup2(DpadUpCharDevice2); + std::string dpddown2(DpadDownCharDevice2); + std::string dpdleft2(DpadLeftCharDevice2); + std::string dpdright2(DpadRightCharDevice2); + + int serviceread = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, true); + int creditnumber = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + int creditnumber1 = helpers->ReadIntPtr((INT_PTR)creditnumber + 0x20, false); + int gearnumber = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00953F70, false); + int gearnumber1 = helpers->ReadIntPtr((INT_PTR)gearnumber + 0x5C, false); + int gearnumber2 = helpers->ReadIntPtr((INT_PTR)gearnumber1 + 0x390, false); + int gearnumber3 = helpers->ReadIntPtr((INT_PTR)gearnumber2 + 0x18, false); + + //Added 2nd device stuff from here + 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); + SDL_JoystickGUID guid, dev_guid; + int numJoysticks = SDL_NumJoysticks(); + std::string njs = std::to_string(numJoysticks); + ((char)njs.c_str()); + for (int i = 0; i < SDL_NumJoysticks(); i++) + { + SDL_Joystick* js2 = SDL_JoystickOpen(i); + joystick_index2 = SDL_JoystickInstanceID(js2); + SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2); + char guid_str[1024]; + SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); + const char* name = SDL_JoystickName(js2); + char text[256]; + sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str); + guid = SDL_JoystickGetGUIDFromString(joystick_guid); + dev_guid = SDL_JoystickGetGUID(js2); + SDL_JoystickClose(js2); + if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID))) + { + GameController2 = SDL_JoystickOpen(i); + break; + } + } + + //if (InputDeviceCombinedPedals == 1) + //{ + // bool BrakePedalFix = true; + //} + + if (SequentialGears == 1) + { + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x95DDA, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x95DDB, false); + helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x95DDC, false); + } + + const int WHEEL_DEAD_ZONE = (SteeringDeadzone * 100.0); + const int ACCL_DEAD_ZONE = (1 + PedalDeadzone * 100.0); + const int BRAKE_DEAD_ZONE = (1 + PedalDeadzone * 100.0); + const int SETUP_DEAD_ZONE = 20000; + SDL_Event e; + while (SDL_PollEvent(&e) != 0) + { + if ((e.type == SDL_JOYAXISMOTION) & (ShowAxisForSetup == 0)) + { + if (e.jaxis.which == joystick_index1) + { + if (e.jaxis.axis == InputDeviceWheelSteeringAxis) + { + //Left of dead zone + if (e.jaxis.value < -WHEEL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - WHEEL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B39, (128 + (e.jaxis.value + WHEEL_DEAD_ZONE) / 255), false); + } + //Right of dead zone + else if (e.jaxis.value > WHEEL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + WHEEL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B39, (127 + (e.jaxis.value - WHEEL_DEAD_ZONE) / 255), false); + } + else if ((e.jaxis.value < WHEEL_DEAD_ZONE) & (e.jaxis.value > -WHEEL_DEAD_ZONE)) + { + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B39, 0x7F, false); + } + } + if (InputDeviceWheelReverseAxis == 1) + { + if (InputDeviceCombinedPedals == 1) + { + if (e.jaxis.axis == InputDeviceWheelAcclAxis) + { + if (e.jaxis.value < -ACCL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, ((-e.jaxis.value + ACCL_DEAD_ZONE) / 128.5), false); + } + else if (e.jaxis.value > ACCL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - ACCL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, ((e.jaxis.value + ACCL_DEAD_ZONE) / 128), false); + } + else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) + { + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 0x00, false); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 0x00, false); + } + } + } + else + { + if (e.jaxis.axis == InputDeviceWheelAcclAxis) + { + if (e.jaxis.value < -ACCL_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 127 - e.jaxis.value, false); + } + else if (e.jaxis.value > ACCL_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 128 - e.jaxis.value, false); + } + } + else if (e.jaxis.axis == InputDeviceWheelBrakeAxis) + { + if (e.jaxis.value < -BRAKE_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 127 - e.jaxis.value, false); + } + else if (e.jaxis.value > BRAKE_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 128 - e.jaxis.value, false); + } + } + } + } + else + { + if (InputDeviceCombinedPedals == 1) + { + //for (static bool BrakePedalFix = true; BrakePedalFix; BrakePedalFix = false) + //{ + //helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 0xFF, false); + //} + + if (e.jaxis.axis == InputDeviceWheelAcclAxis) + { + if (e.jaxis.value < -ACCL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - ACCL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, ((e.jaxis.value + ACCL_DEAD_ZONE) / 128), false); + } + else if (e.jaxis.value > ACCL_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + ACCL_DEAD_ZONE; + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, ((-e.jaxis.value + ACCL_DEAD_ZONE) / 128), false); + } + else if ((e.jaxis.value < ACCL_DEAD_ZONE) & (e.jaxis.value > -ACCL_DEAD_ZONE)) + { + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 0xFF, false); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 0xFF, false); + } + } + } + else + { + if (e.jaxis.axis == InputDeviceWheelAcclAxis) + { + if (e.jaxis.value < -ACCL_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 128 + e.jaxis.value, false); + } + else if (e.jaxis.value > ACCL_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B3D, 127 + e.jaxis.value, false); + } + } + if (e.jaxis.axis == InputDeviceWheelBrakeAxis) + { + if (e.jaxis.value < -BRAKE_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 128 + e.jaxis.value, false); + } + else if (e.jaxis.value > BRAKE_DEAD_ZONE) + { + e.jaxis.value = (e.jaxis.value / 255); + helpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B41, 127 + e.jaxis.value, false); + } + } + } + } + } + } + + + if (ShowAxisForSetup == 1) + { + if (e.type == SDL_JOYAXISMOTION) + { + if (e.jaxis.which == joystick_index1) + { + if (e.jaxis.axis == 0) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 0 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 0 Moved", "", 0); + } + } + else if (e.jaxis.axis == 1) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 1 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 1 Moved", "", 0); + } + } + else if (e.jaxis.axis == 2) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 2 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 2 Moved", "", 0); + } + } + else if (e.jaxis.axis == 3) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 3 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 3 Moved", "", 0); + } + } + else if (e.jaxis.axis == 4) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 4 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 4 Moved", "", 0); + } + } + else if (e.jaxis.axis == 5) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 5 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 5 Moved", "", 0); + } + } + else if (e.jaxis.axis == 6) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 6 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 6 Moved", "", 0); + } + } + else if (e.jaxis.axis == 7) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 7 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 7 Moved", "", 0); + } + } + else if (e.jaxis.axis == 8) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 8 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 8 Moved", "", 0); + } + } + else if (e.jaxis.axis == 9) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 9 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 9 Moved", "", 0); + } + } + else if (e.jaxis.axis == 10) + { + if (e.jaxis.value < -SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value - SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 10 Moved", "", 0); + } + else if (e.jaxis.value > SETUP_DEAD_ZONE) + { + e.jaxis.value = e.jaxis.value + SETUP_DEAD_ZONE; + MessageBoxA(NULL, "Axis 10 Moved", "", 0); + } + } + } + } + } + + if (ShowButtonNumbersForSetup == 1) + { + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jaxis.which == joystick_index1 || e.jaxis.which == joystick_index2) + { + if (e.jbutton.button == 0) + { + MessageBoxA(NULL, "Button 0 Pressed", "", 0); + } + else if (e.jbutton.button == 1) + { + MessageBoxA(NULL, "Button 1 Pressed", "", 0); + } + else if (e.jbutton.button == 2) + { + MessageBoxA(NULL, "Button 2 Pressed", "", 0); + } + else if (e.jbutton.button == 3) + { + MessageBoxA(NULL, "Button 3 Pressed", "", 0); + } + else if (e.jbutton.button == 4) + { + MessageBoxA(NULL, "Button 4 Pressed", "", 0); + } + else if (e.jbutton.button == 5) + { + MessageBoxA(NULL, "Button 5 Pressed", "", 0); + } + else if (e.jbutton.button == 6) + { + MessageBoxA(NULL, "Button 6 Pressed", "", 0); + } + else if (e.jbutton.button == 7) + { + MessageBoxA(NULL, "Button 7 Pressed", "", 0); + } + else if (e.jbutton.button == 8) + { + MessageBoxA(NULL, "Button 8 Pressed", "", 0); + } + else if (e.jbutton.button == 9) + { + MessageBoxA(NULL, "Button 9 Pressed", "", 0); + } + else if (e.jbutton.button == 10) + { + MessageBoxA(NULL, "Button 10 Pressed", "", 0); + } + else if (e.jbutton.button == 11) + { + MessageBoxA(NULL, "Button 11 Pressed", "", 0); + } + else if (e.jbutton.button == 12) + { + MessageBoxA(NULL, "Button 12 Pressed", "", 0); + } + else if (e.jbutton.button == 13) + { + MessageBoxA(NULL, "Button 13 Pressed", "", 0); + } + else if (e.jbutton.button == 14) + { + MessageBoxA(NULL, "Button 14 Pressed", "", 0); + } + else if (e.jbutton.button == 15) + { + MessageBoxA(NULL, "Button 15 Pressed", "", 0); + } + else if (e.jbutton.button == 16) + { + MessageBoxA(NULL, "Button 16 Pressed", "", 0); + } + else if (e.jbutton.button == 17) + { + MessageBoxA(NULL, "Button 17 Pressed", "", 0); + } + else if (e.jbutton.button == 18) + { + MessageBoxA(NULL, "Button 18 Pressed", "", 0); + } + else if (e.jbutton.button == 19) + { + MessageBoxA(NULL, "Button 19 Pressed", "", 0); + } + else if (e.jbutton.button == 20) + { + MessageBoxA(NULL, "Button 20 Pressed", "", 0); + } + else if (e.jbutton.button == 21) + { + MessageBoxA(NULL, "Button 21 Pressed", "", 0); + } + else if (e.jbutton.button == 22) + { + MessageBoxA(NULL, "Button 22 Pressed", "", 0); + } + else if (e.jbutton.button == 23) + { + MessageBoxA(NULL, "Button 23 Pressed", "", 0); + } + else if (e.jbutton.button == 24) + { + MessageBoxA(NULL, "Button 24 Pressed", "", 0); + } + else if (e.jbutton.button == 25) + { + MessageBoxA(NULL, "Button 25 Pressed", "", 0); + } + else if (e.jbutton.button == 26) + { + MessageBoxA(NULL, "Button 26 Pressed", "", 0); + } + else if (e.jbutton.button == 27) + { + MessageBoxA(NULL, "Button 27 Pressed", "", 0); + } + else if (e.jbutton.button == 28) + { + MessageBoxA(NULL, "Button 28 Pressed", "", 0); + } + else if (e.jbutton.button == 29) + { + MessageBoxA(NULL, "Button 29 Pressed", "", 0); + } + else if (e.jbutton.button == 30) + { + MessageBoxA(NULL, "Button 30 Pressed", "", 0); + } + } + } + } + + if (e.jhat.type == SDL_JOYHATMOTION) + { + if (e.jhat.value == SDL_HAT_CENTERED) + { + if (e.jhat.which == joystick_index1) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + + else if (e.jhat.which == joystick_index2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + } + else if (e.jhat.value == SDL_HAT_UP) + { + if (e.jhat.which == joystick_index1) + { + if (dpdup.compare(exit) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdup.compare(test) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdup.compare(service) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdup.compare(coin) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdup.compare(view) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdup.compare(three) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdup.compare(lvup) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdup.compare(lvdown) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdup.compare(lvleft) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdup.compare(lvright) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + else if (e.jhat.which == joystick_index2) + { + if (dpdup2.compare(exit2) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdup2.compare(test2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdup2.compare(service2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdup2.compare(coin2) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdup2.compare(view2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdup2.compare(three2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdup2.compare(lvup2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdup2.compare(lvdown2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdup2.compare(lvleft2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdup2.compare(lvright2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + } + else if (e.jhat.value == SDL_HAT_DOWN) + { + if (e.jhat.which == joystick_index1) + { + if (dpddown.compare(exit) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpddown.compare(test) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpddown.compare(service) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpddown.compare(coin) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpddown.compare(view) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpddown.compare(three) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpddown.compare(lvup) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpddown.compare(lvdown) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpddown.compare(lvleft) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpddown.compare(lvright) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + else if (e.jhat.which == joystick_index2) + { + if (dpddown2.compare(exit2) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdup2.compare(test2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpddown2.compare(service2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpddown2.compare(coin2) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpddown2.compare(view2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpddown2.compare(three2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpddown2.compare(lvup2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpddown2.compare(lvdown2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpddown2.compare(lvleft2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpddown2.compare(lvright2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + } + else if (e.jhat.value == SDL_HAT_LEFT) + { + if (e.jhat.which == joystick_index1) + { + if (dpdleft.compare(exit) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdleft.compare(test) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdleft.compare(service) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdleft.compare(coin) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdleft.compare(view) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdleft.compare(three) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdleft.compare(lvup) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdleft.compare(lvdown) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdleft.compare(lvleft) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdleft.compare(lvright) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + else if (e.jhat.which == joystick_index2) + { + if (dpdleft2.compare(exit2) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdleft2.compare(test2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdleft2.compare(service2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdleft2.compare(coin2) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdleft2.compare(view2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdleft2.compare(three2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdleft2.compare(lvup2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdleft2.compare(lvdown2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdleft2.compare(lvleft2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdleft2.compare(lvright2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + } + else if (e.jhat.value == SDL_HAT_RIGHT) + { + if (e.jhat.which == joystick_index1) + { + if (dpdright.compare(exit) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdright.compare(test) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdright.compare(service) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdright.compare(coin) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdright.compare(view) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdright.compare(three) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdright.compare(lvup) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdright.compare(lvdown) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdright.compare(lvleft) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdright.compare(lvright) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + else if (e.jhat.which == joystick_index2) + { + if (dpdright2.compare(exit2) == 0) + { + system("taskkill /f /im spice.exe"); + } + else if (dpdright2.compare(test2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (dpdright2.compare(service2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (dpdright2.compare(coin2) == 0) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (dpdright2.compare(view2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (dpdright2.compare(three2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if (dpdright2.compare(lvup2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if (dpdright2.compare(lvdown2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if (dpdright2.compare(lvleft2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (dpdright2.compare(lvright2) == 0) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + } + } + + if (e.type == SDL_JOYBUTTONDOWN) + { + if (e.jbutton.which == joystick_index1) + { + if (e.jbutton.button == TestButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (e.jbutton.button == ExitButton) + { + system("taskkill /f /im spice.exe"); + } + else if (e.jbutton.button == ServiceButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (e.jbutton.button == CreditButton) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (e.jbutton.button == ViewButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (e.jbutton.button == ThreeDimensionalButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if ((e.jbutton.button == leverUp) & (SequentialGears == 0)) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if ((e.jbutton.button == leverUp) & (SequentialGears == 1) & (gearnumber3 < 0x06)) + { + int Writegearnumber = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00953F70, false); + int Writegearnumber1 = helpers->ReadIntPtr((INT_PTR)Writegearnumber + 0x5C, false); + int Writegearnumber2 = helpers->ReadIntPtr((INT_PTR)Writegearnumber1 + 0x390, false); + helpers->WriteIntPtr((INT_PTR)Writegearnumber2 + 0x18, ++gearnumber3, false); + } + else if ((e.jbutton.button == leverDown) & (SequentialGears == 0)) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if ((e.jbutton.button == leverDown) & (SequentialGears == 1) & (gearnumber3 > 0x01)) + { + int Writegearnumber = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00953F70, false); + int Writegearnumber1 = helpers->ReadIntPtr((INT_PTR)Writegearnumber + 0x5C, false); + int Writegearnumber2 = helpers->ReadIntPtr((INT_PTR)Writegearnumber1 + 0x390, false); + helpers->WriteIntPtr((INT_PTR)Writegearnumber2 + 0x18, --gearnumber3, false); + } + else if (e.jbutton.button == leverLeft) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (e.jbutton.button == leverRight) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + else if (e.jbutton.which == joystick_index2) + { + if (e.jbutton.button == TestButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false); + } + else if (e.jbutton.button == ExitButtonDevice2) + { + system("taskkill /f /im spice.exe"); + } + else if (e.jbutton.button == ServiceButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false); + } + else if (e.jbutton.button == CreditButtonDevice2) + { + int credit = helpers->ReadIntPtr((INT_PTR)gl_hlibavs + 0x00042C10, false); + helpers->WriteIntPtr((INT_PTR)credit + 0x20, ++creditnumber1, false); + } + else if (e.jbutton.button == ViewButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x400, false); + } + else if (e.jbutton.button == ThreeDimensionalButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x800, false); + } + else if ((e.jbutton.button == leverUpDevice2) & (SequentialGears == 0)) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x1040, false); + } + else if ((e.jbutton.button == leverUpDevice2) & (SequentialGears == 1) & (gearnumber3 < 0x06)) + { + int Writegearnumber = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00953F70, false); + int Writegearnumber1 = helpers->ReadIntPtr((INT_PTR)Writegearnumber + 0x5C, false); + int Writegearnumber2 = helpers->ReadIntPtr((INT_PTR)Writegearnumber1 + 0x390, false); + helpers->WriteIntPtr((INT_PTR)Writegearnumber2 + 0x18, ++gearnumber3, false); + } + else if ((e.jbutton.button == leverDownDevice2) & (SequentialGears == 0)) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x2080, false); + } + else if ((e.jbutton.button == leverDownDevice2) & (SequentialGears == 1) & (gearnumber3 > 0x01)) + { + int Writegearnumber = helpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00953F70, false); + int Writegearnumber1 = helpers->ReadIntPtr((INT_PTR)Writegearnumber + 0x5C, false); + int Writegearnumber2 = helpers->ReadIntPtr((INT_PTR)Writegearnumber1 + 0x390, false); + helpers->WriteIntPtr((INT_PTR)Writegearnumber2 + 0x18, --gearnumber3, false); + } + else if (e.jbutton.button == leverLeftDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x4000, false); + } + else if (e.jbutton.button == leverRightDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x8000, false); + } + } + } + if (e.type == SDL_JOYBUTTONUP) + { + if (e.jbutton.which == joystick_index1) + { + if (e.jbutton.button == TestButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ServiceButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ViewButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ThreeDimensionalButton) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverUp) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverDown) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverLeft) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverRight) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + } + else if (e.jbutton.which == joystick_index2) + { + if (e.jbutton.button == TestButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ServiceButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ViewButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == ThreeDimensionalButtonDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverUpDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverDownDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverLeftDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + else if (e.jbutton.button == leverRightDevice2) + { + helpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x0000, false); + } + } + } + } + } + + + UINT8 ff1 = helpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BB9, false); + UINT8 ff2 = helpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBA, false); + helpers->log("got value: "); + std::string ffs = std::to_string(ff2); + helpers->log((char *)ffs.c_str()); + + if (FFBMode == 0) + { + if ((ff2 > 0x00) & (ff2 < 0x40)) + { + double percentForce = (ff2) / 63.0; + double percentLength = 100; + triggers->LeftRight(percentForce, percentForce, percentLength); + triggers->Sine(120, 120, percentForce); + } + if ((ff1 > 0x00) & (ff1 < 0x08)) + { + //helpers->log("moving wheel left"); + double percentForce = (ff1) / 7.0; + double percentLength = 100; + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + } + else if ((ff1 > 0x07) & (ff1 < 0x10)) + { + //helpers->log("moving wheel right"); + double percentForce = (16 - ff1) / 8.0; + double percentLength = 100; + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + } + } + else if (FFBMode == 1) + { + if ((ff2 > 0x00) & (ff2 < 0x40)) + { + double percentForce = (ff2) / 63.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), pow(percentForce, 0.5), percentLength); + triggers->Sine(120, 120, pow(percentForce, 0.5)); + } + if ((ff1 > 0x00) & (ff1 < 0x08)) + { + //helpers->log("moving wheel left"); + double percentForce = (ff1) / 7.0; + double percentLength = 100; + triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5))); + } + else if ((ff1 > 0x07) & (ff1 < 0x10)) + { + //helpers->log("moving wheel right"); + double percentForce = (16 - ff1) / 8.0; + double percentLength = 100; + triggers->LeftRight(0, pow(percentForce, 0.5), percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5))); + } + } + } \ No newline at end of file diff --git a/Game Files/RoadFighters3D.h b/Game Files/RoadFighters3D.h new file mode 100644 index 0000000..aecd348 --- /dev/null +++ b/Game Files/RoadFighters3D.h @@ -0,0 +1,7 @@ +#pragma once +#include "../Common Files/Game.h" +class RoadFighters3D : public Game { + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/SegaRacingClassic.cpp b/Game Files/SegaRacingClassic.cpp new file mode 100644 index 0000000..3239b6b --- /dev/null +++ b/Game Files/SegaRacingClassic.cpp @@ -0,0 +1,92 @@ +#include +#include "SegaRacingClassic.h" + +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); + + 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(percentForce); + } + 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->LeftRight(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->LeftRight(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.5)); + } + 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->LeftRight(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->LeftRight(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 new file mode 100644 index 0000000..103bf16 --- /dev/null +++ b/Game Files/SegaRacingClassic.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class SegaRacingClassic : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/SegaRally3.cpp b/Game Files/SegaRally3.cpp new file mode 100644 index 0000000..ed35afd --- /dev/null +++ b/Game Files/SegaRally3.cpp @@ -0,0 +1,39 @@ +#include +#include "SegaRally3.h" + +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()); + + if (ff > 15) + { + helpers->log("moving wheel right"); + // assume that 30 is the weakest and 16 is the strongest + double percentForce = (31 - ff) / 15.0; + double percentLength = 100; + // direction from left => makes wheel turn right + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + lastWasStop = 0; + } + else if (ff > 0) + { + helpers->log("moving wheel left"); + // assume that 1 is the strongest and 15 is the weakest + double percentForce = (16 - ff) / 15.0; + double percentLength = 100; + // direction from right => makes wheel turn left + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + 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 new file mode 100644 index 0000000..285727d --- /dev/null +++ b/Game Files/SegaRally3.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/TeknoParrotGame.h" + +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 new file mode 100644 index 0000000..2d2ee6e --- /dev/null +++ b/Game Files/SonicSegaAllStarsRacing.cpp @@ -0,0 +1,43 @@ +#include +#include "SonicSegaAllStarsRacing.h" + +void SonicSegaAllStarsRacing::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + INT_PTR FFBEnable = helpers->ReadByte(0x5CD858, /* isRelativeOffset*/ true); + INT_PTR FFB = helpers->ReadByte(0x5CD864, /* isRelativeOffset*/ true); + + { + //Enable FFB + 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->LeftRight(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->LeftRight(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 new file mode 100644 index 0000000..203c192 --- /dev/null +++ b/Game Files/SonicSegaAllStarsRacing.h @@ -0,0 +1,8 @@ +#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.cpp b/Game Files/TestGame.cpp new file mode 100644 index 0000000..8e08eb4 --- /dev/null +++ b/Game Files/TestGame.cpp @@ -0,0 +1,40 @@ +#include +#include "TestGame.h" + +//settingsFN copied from DllMain.cpp; renamed from settingsFilename +wchar_t *settingsFN = TEXT(".\\FFBPlugin.ini"); + +//GameId test values: +//const int TEST_GAME_CONST = -1; +//const int TEST_GAME_SINE = -2; +//const int TEST_GAME_FRICTION = -3; +//const int TEST_GAME_SPRING = -4; +//const int TEST_GAME_HEAVY = -5; +//const int TEST_GAME_LOOSE = -6; +int configGameIdEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFN); + +void TestGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + switch (configGameIdEffect) { + case -1: + // turn left + triggers->Constant(constants->DIRECTION_FROM_RIGHT, 1); + break; + case -2: + triggers->Sine(125, 100, 0.25); + break; + case -3: + triggers->Friction(1); + break; + case -4: + triggers->Spring(1); + break; + case -5: + triggers->Friction(1); + triggers->Spring(1); + break; + case -6: + triggers->Friction(0); + triggers->Spring(0); + break; + } +} \ No newline at end of file diff --git a/Game Files/TestGame.h b/Game Files/TestGame.h new file mode 100644 index 0000000..9ef4255 --- /dev/null +++ b/Game Files/TestGame.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class TestGame : public Game { + int lastWasStop = 0; + + public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/WMMT5.cpp b/Game Files/WMMT5.cpp new file mode 100644 index 0000000..1466e58 --- /dev/null +++ b/Game Files/WMMT5.cpp @@ -0,0 +1,57 @@ +#include +#include "WMMT5.h" + +void WMMT5::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + float roll = helpers->ReadFloat32(0x196F194, /* isRelativeOffset*/ true); + float friction = helpers->ReadFloat32(0x196F18C, /* isRelativeOffset*/ true); + float sine = helpers->ReadFloat32(0x196F188, /* isRelativeOffset*/ true); + helpers->log("got value: "); + std::string ffs = std::to_string(roll); + helpers->log((char *)ffs.c_str()); + + { + //Trigger Spring the entire time like real cabinet + double percentForce = 0.7; + triggers->Springi(percentForce); + } + + if (0 < roll) + { + helpers->log("moving wheel right"); + double percentForce = (1.0 - roll); + double percentLength = (250); + // direction from right => makes wheel turn left + triggers->LeftRight(percentForce, 0, percentLength); + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + + } + else if (0 > roll) + { + helpers->log("moving wheel left"); + double percentForce = (roll + 1.0); + double percentLength = (250); + // direction from left => makes wheel turn right + triggers->LeftRight(0, percentForce, percentLength); + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + + } + else if (0 < friction) + { + helpers->log("moving wheel right"); + double percentForce = (0.7 - friction); + triggers->Friction(percentForce); + } + else if (0 < sine) + { + helpers->log("moving wheel right"); + double percentForce = (0.6 - sine); + triggers->Sine(120, 120, percentForce); + } + else if (0 > sine) + { + helpers->log("moving wheel left"); + double percentForce = (sine + 0.6); + triggers->Sine(120, 120, percentForce); + } +} \ No newline at end of file diff --git a/Game Files/WMMT5.h b/Game Files/WMMT5.h new file mode 100644 index 0000000..c37ecc6 --- /dev/null +++ b/Game Files/WMMT5.h @@ -0,0 +1,8 @@ +#pragma once +#include "../Common Files/Game.h" +class WMMT5 : public Game { + int lastWasStop = 0; + + public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/Game Files/WackyRaces.cpp b/Game Files/WackyRaces.cpp new file mode 100644 index 0000000..a6fb0d4 --- /dev/null +++ b/Game Files/WackyRaces.cpp @@ -0,0 +1,122 @@ +#include +#include "WackyRaces.h" + +int ttx2wr(int ffRaw) { + switch (ffRaw) { + // moving left, from weakest to strongest (30 => 16). + case 4096: + return 30; + case 64: + return 29; + case 4160: + return 28; + case 2048: + return 27; + case 6144: + return 26; + case 2112: + return 25; + case 6208: + return 24; + case 32: + return 23; + case 4128: + return 22; + case 96: + return 21; + case 4192: + return 20; + case 2080: + return 19; + case 6176: + return 18; + case 2144: + return 17; + case 6240: + return 16; + // moving right, from weakest to strongest (15 => 1) + case 12288: + return 15; + case 8256: + return 14; + case 12352: + return 13; + case 10240: + return 12; + case 14336: + return 11; + case 10304: + return 10; + case 14400: + return 9; + case 8224: + return 8; + case 12320: + return 7; + case 8288: + return 6; + case 12384: + return 5; + case 10272: + return 4; + case 14368: + return 3; + case 10336: + return 2; + case 14432: + return 1; + default: + return 0; + } +} + +void WackyRaces::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { + + int ff = 0; + + { + 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->LeftRight(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->LeftRight(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 new file mode 100644 index 0000000..6cf1d45 --- /dev/null +++ b/Game Files/WackyRaces.h @@ -0,0 +1,9 @@ +#pragma once +#include "../Common Files/Game.h" + +class WackyRaces : public Game { + int lastWasStop = 0; + +public: + void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/IDirectInputDevice.cpp b/IDirectInputDevice.cpp new file mode 100644 index 0000000..df25ff1 --- /dev/null +++ b/IDirectInputDevice.cpp @@ -0,0 +1,225 @@ +#include "IDirectInputDevice.h" + +DirectInputDeviceWrapper::DirectInputDeviceWrapper(LPVOID device, bool unicode) +{ + useUnicode = unicode; + if (unicode) + { + pDeviceW = (LPDIRECTINPUTDEVICE8W)device; + pDeviceA = NULL; + } + else + { + pDeviceA = (LPDIRECTINPUTDEVICE8A)device; + pDeviceW = NULL; + } +} + +DirectInputDeviceWrapper::~DirectInputDeviceWrapper(void) +{ +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::QueryInterface(REFIID riid, LPVOID* ppvObj) +{ + if (pDeviceA) return pDeviceA->QueryInterface(riid, ppvObj); + return pDeviceW->QueryInterface(riid, ppvObj); +} + +ULONG STDMETHODCALLTYPE DirectInputDeviceWrapper::AddRef(void) +{ + if (pDeviceA) return pDeviceA->AddRef(); + return pDeviceW->AddRef(); +} + +ULONG STDMETHODCALLTYPE DirectInputDeviceWrapper::Release(void) +{ + if (pDeviceA) return pDeviceA->Release(); + return pDeviceW->Release(); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Acquire(void) +{ + if (pDeviceA) return pDeviceA->Acquire(); + return pDeviceW->Acquire(); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT* ppdeff, LPUNKNOWN punkOuter) +{ + if (pDeviceA) return pDeviceA->CreateEffect(rguid, lpeff, ppdeff, punkOuter); + return pDeviceW->CreateEffect(rguid, lpeff, ppdeff, punkOuter); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl) +{ + if (pDeviceA) return pDeviceA->EnumCreatedEffectObjects(lpCallback, pvRef, fl); + return pDeviceW->EnumCreatedEffectObjects(lpCallback, pvRef, fl); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::EnumEffects(LPDIENUMEFFECTSCALLBACK lpCallback, LPVOID pvRef, DWORD dwEffType) +{ + if (pDeviceA) return pDeviceA->EnumEffects((LPDIENUMEFFECTSCALLBACKA) lpCallback, pvRef, dwEffType); + return pDeviceW->EnumEffects(lpCallback, pvRef, dwEffType); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::EnumEffectsInFile(LPCTSTR lptszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->EnumEffectsInFile((LPCSTR) lptszFileName, pec, pvRef, dwFlags); + return pDeviceW->EnumEffectsInFile(lptszFileName, pec, pvRef, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->EnumObjects((LPDIENUMDEVICEOBJECTSCALLBACKA)lpCallback, pvRef, dwFlags); + return pDeviceW->EnumObjects(lpCallback, pvRef, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Escape(LPDIEFFESCAPE pesc) +{ + if (pDeviceA) return pDeviceA->Escape(pesc); + return pDeviceW->Escape(pesc); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetCapabilities(LPDIDEVCAPS lpDIDevCaps) +{ + if (pDeviceA) return pDeviceA->GetCapabilities(lpDIDevCaps); + return pDeviceW->GetCapabilities(lpDIDevCaps); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->GetDeviceData(cbObjectData, rgdod, pdwInOut, dwFlags); + return pDeviceW->GetDeviceData(cbObjectData, rgdod, pdwInOut, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetDeviceInfo(LPDIDEVICEINSTANCE pdidi) +{ + if (pDeviceA) return pDeviceA->GetDeviceInfo((LPDIDEVICEINSTANCEA) pdidi); + return pDeviceW->GetDeviceInfo(pdidi); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetDeviceState(DWORD cbData, LPVOID lpvData) +{ + if (pDeviceA) return pDeviceA->GetDeviceState(cbData, lpvData); + return pDeviceW->GetDeviceState(cbData, lpvData); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetEffectInfo(LPDIEFFECTINFO pdei, REFGUID rguid) +{ + if (pDeviceA) return pDeviceA->GetEffectInfo((LPDIEFFECTINFOA) pdei, rguid); + return pDeviceW->GetEffectInfo(pdei, rguid); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetForceFeedbackState(LPDWORD pdwOut) +{ + if (pDeviceA) return pDeviceA->GetForceFeedbackState(pdwOut); + return pDeviceW->GetForceFeedbackState(pdwOut); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetObjectInfo(LPDIDEVICEOBJECTINSTANCE pdidoi, DWORD dwObj, DWORD dwHow) +{ + if (pDeviceA) return pDeviceA->GetObjectInfo((LPDIDEVICEOBJECTINSTANCEA) pdidoi, dwObj, dwHow); + return pDeviceW->GetObjectInfo(pdidoi, dwObj, dwHow); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetProperty(REFGUID rguidProp, LPDIPROPHEADER pdiph) +{ + if (pDeviceA) return pDeviceA->GetProperty(rguidProp, pdiph); + return pDeviceW->GetProperty(rguidProp, pdiph); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Initialize(HINSTANCE hinst, DWORD dwVersion, REFGUID rguid) +{ + if (pDeviceA) return pDeviceA->Initialize(hinst, dwVersion, rguid); + return pDeviceW->Initialize(hinst, dwVersion, rguid); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Poll(void) +{ + if (pDeviceA) return pDeviceA->Poll(); + return pDeviceW->Poll(); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::RunControlPanel(HWND hwndOwner, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->RunControlPanel(hwndOwner, dwFlags); + return pDeviceW->RunControlPanel(hwndOwner, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SendDeviceData(DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl) +{ + if (pDeviceA) return pDeviceA->SendDeviceData(cbObjectData, rgdod, pdwInOut, fl); + return pDeviceW->SendDeviceData(cbObjectData, rgdod, pdwInOut, fl); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SendForceFeedbackCommand(DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->SendForceFeedbackCommand(dwFlags); + return pDeviceW->SendForceFeedbackCommand(dwFlags); +} + +bool hackFix = false; + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SetCooperativeLevel(HWND hwnd, DWORD dwFlags) +{ + if (hackFix) + { + if (dwFlags & DISCL_EXCLUSIVE) + { + dwFlags &= ~DISCL_EXCLUSIVE; + dwFlags |= DISCL_NONEXCLUSIVE; + } + } + if (pDeviceA) return pDeviceA->SetCooperativeLevel(hwnd, dwFlags); + return pDeviceW->SetCooperativeLevel(hwnd, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SetDataFormat(LPCDIDATAFORMAT lpdf) +{ + if (pDeviceA) return pDeviceA->SetDataFormat(lpdf); + return pDeviceW->SetDataFormat(lpdf); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SetEventNotification(HANDLE hEvent) +{ + if (pDeviceA) return pDeviceA->SetEventNotification(hEvent); + return pDeviceW->SetEventNotification(hEvent); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SetProperty(REFGUID rguidProp, LPCDIPROPHEADER pdiph) +{ + if (pDeviceA) return pDeviceA->SetProperty(rguidProp, pdiph); + return pDeviceW->SetProperty(rguidProp, pdiph); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::Unacquire(void) +{ + if (pDeviceA) return pDeviceA->Unacquire(); + return pDeviceW->Unacquire(); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::WriteEffectToFile(LPCTSTR lptszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->WriteEffectToFile((LPCSTR) lptszFileName, dwEntries, rgDiFileEft, dwFlags); + return pDeviceW->WriteEffectToFile(lptszFileName, dwEntries, rgDiFileEft, dwFlags); +} + +#if DIRECTINPUT_VERSION >= 0x0800 + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::BuildActionMap(LPDIACTIONFORMAT lpdiaf, LPCTSTR lpszUserName, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->BuildActionMap((LPDIACTIONFORMATA) lpdiaf, (LPCSTR) lpszUserName, dwFlags); + return pDeviceW->BuildActionMap(lpdiaf, lpszUserName, dwFlags); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::GetImageInfo(LPDIDEVICEIMAGEINFOHEADER lpdiDevImageInfoHeader) +{ + if (pDeviceA) return pDeviceA->GetImageInfo((LPDIDEVICEIMAGEINFOHEADERA) lpdiDevImageInfoHeader); + return pDeviceW->GetImageInfo(lpdiDevImageInfoHeader); +} + +HRESULT STDMETHODCALLTYPE DirectInputDeviceWrapper::SetActionMap(LPDIACTIONFORMAT lpdiActionFormat, LPCTSTR lptszUserName, DWORD dwFlags) +{ + if (pDeviceA) return pDeviceA->SetActionMap((LPDIACTIONFORMATA)lpdiActionFormat, (LPCSTR)lptszUserName, dwFlags); + return pDeviceW->SetActionMap(lpdiActionFormat, lptszUserName, dwFlags); +} +#endif diff --git a/IDirectInputDevice.h b/IDirectInputDevice.h new file mode 100644 index 0000000..2467d1d --- /dev/null +++ b/IDirectInputDevice.h @@ -0,0 +1,54 @@ +#pragma once + +#include "dinput.h" + +struct DirectInputDeviceWrapper : public IDirectInputDevice8 +{ +private: + LPDIRECTINPUTDEVICE8A pDeviceA; + LPDIRECTINPUTDEVICE8W pDeviceW; + bool useUnicode; + +public: + DirectInputDeviceWrapper( LPVOID device, bool unicode ); + virtual ~DirectInputDeviceWrapper(void); + +public: + // -------- METHODS: IUnknown ---------------------------------------------- // + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID* ppvObj); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + // -------- METHODS: IDirectInputDevice COMMON ----------------------------- // + virtual HRESULT STDMETHODCALLTYPE Acquire(void); + virtual HRESULT STDMETHODCALLTYPE CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT* ppdeff, LPUNKNOWN punkOuter); + virtual HRESULT STDMETHODCALLTYPE EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl); + virtual HRESULT STDMETHODCALLTYPE EnumEffects(LPDIENUMEFFECTSCALLBACK lpCallback, LPVOID pvRef, DWORD dwEffType); + virtual HRESULT STDMETHODCALLTYPE EnumEffectsInFile(LPCTSTR lptszFileName, LPDIENUMEFFECTSINFILECALLBACK pec, LPVOID pvRef, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE Escape(LPDIEFFESCAPE pesc); + virtual HRESULT STDMETHODCALLTYPE GetCapabilities(LPDIDEVCAPS lpDIDevCaps); + virtual HRESULT STDMETHODCALLTYPE GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetDeviceInfo(LPDIDEVICEINSTANCE pdidi); + virtual HRESULT STDMETHODCALLTYPE GetDeviceState(DWORD cbData, LPVOID lpvData); + virtual HRESULT STDMETHODCALLTYPE GetEffectInfo(LPDIEFFECTINFO pdei, REFGUID rguid); + virtual HRESULT STDMETHODCALLTYPE GetForceFeedbackState(LPDWORD pdwOut); + virtual HRESULT STDMETHODCALLTYPE GetObjectInfo(LPDIDEVICEOBJECTINSTANCE pdidoi, DWORD dwObj, DWORD dwHow); + virtual HRESULT STDMETHODCALLTYPE GetProperty(REFGUID rguidProp, LPDIPROPHEADER pdiph); + virtual HRESULT STDMETHODCALLTYPE Initialize(HINSTANCE hinst, DWORD dwVersion, REFGUID rguid); + virtual HRESULT STDMETHODCALLTYPE Poll(void); + virtual HRESULT STDMETHODCALLTYPE RunControlPanel(HWND hwndOwner, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE SendDeviceData(DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl); + virtual HRESULT STDMETHODCALLTYPE SendForceFeedbackCommand(DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE SetCooperativeLevel(HWND hwnd, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE SetDataFormat(LPCDIDATAFORMAT lpdf); + virtual HRESULT STDMETHODCALLTYPE SetEventNotification(HANDLE hEvent); + virtual HRESULT STDMETHODCALLTYPE SetProperty(REFGUID rguidProp, LPCDIPROPHEADER pdiph); + virtual HRESULT STDMETHODCALLTYPE Unacquire(void); + virtual HRESULT STDMETHODCALLTYPE WriteEffectToFile(LPCTSTR lptszFileName, DWORD dwEntries, LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags); +#if DIRECTINPUT_VERSION >= 0x0800 + // -------- METHODS: IDirectInputDevice8 ONLY ------------------------------ // + virtual HRESULT STDMETHODCALLTYPE BuildActionMap(LPDIACTIONFORMAT lpdiaf, LPCTSTR lpszUserName, DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE GetImageInfo(LPDIDEVICEIMAGEINFOHEADER lpdiDevImageInfoHeader); + virtual HRESULT STDMETHODCALLTYPE SetActionMap(LPDIACTIONFORMAT lpdiActionFormat, LPCTSTR lptszUserName, DWORD dwFlags); +#endif +}; diff --git a/Includes/FFBPlugin.txt b/Includes/FFBPlugin.txt new file mode 100644 index 0000000..f00d79b --- /dev/null +++ b/Includes/FFBPlugin.txt @@ -0,0 +1,417 @@ +***FFB Arcade Plugin*** + +Version 0.8 + +Created by Boomslangnz, Ducon2016 & Spazzy. + +This is a plugin to provide Force Feedback and Rumble (and in certain cases added input support) to various arcade games. Initially this was a small project +to add FFB to Daytona Championship USA and it grew from there to support several more games and rumble was added. +While best efforts were made to try to resemble the real arcade force feedback, It will never be 100% accurate & +in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4. Effects were created entirely from scratch +so are not using any real force feedback values + +***0.8 Changes*** + +- Sorry! Been so busy,never had time to test last release correctly and upgrading SDL2 version broke effects working correctly on all games! + +Reverting back to SDL2 2.0.5 and modified lindbergh game plugins to load SDL22.dll. + +SDL22.dll will be supplied in plugin folders for Lindbergh games and need to be placed into the Teknoparrot folder INSIDE the MAIN Teknoparrot folder. + +SDL2.dll will still be supplied aswell to be placed in same folder as FFBPlugin.ini if you want to use FFBPluginGUI.exe + +Hopefully this makes sense, please ask if you are confused. + +- Outrun 2 now has 2 x plugins. One is the custom effects created from scratch you have been using all this time :) and the other is using the real FFB Address now. +(Big thanks to Reaver for help on getting the real ffb working) + +***0.7 Changes*** + +- Upgraded FFB Arcade Plugin to use SDL 2 2.0.9 version compared to the old 2.0.5 used previously. Will sort out FFB Plugin working when using Faudio on new teknoparrot + +***0.6a Changes*** + +- Modified GUI to check FFBPlugin and load game settings as soon as you choose Force Feedback Setup or Input Setup instead of having game list and potentially writing unnecessary values to ini + +- Added logo on first GUI page made by POOTERMAN (Thanks mate) + +- Defaulted WMMT5 logging to off as plugin hooks GUI lol + +- Added GUI to every plugin folder by default now as it was confusing users with copying GUI to correct folders etc. I have setup correct 32bit and 64bit exe with each plugin + +- Just a note if you are using Lindbergh games and want to use GUI. Copy MetroFramework.dll & SDL2.dll to same folder as elf file (Where FFBPlugin.ini goes too), +opengl32.dll & SDL2.dll goes to Teknoparrot folder as usual. You do not need to copy GUI or Metroframework.dll to Teknoparrot folder at all. + + +***0.6 Changes*** + +- Added support for Mame 0.206 with same games from old 0.199 games. Works with 32bit, 64bit Mame Binary or MameUI64 + +- Added Optional GUI to make modifying settings or setting up deviceguid a bit easier (read below for details, HAS TO BE IN SAME FOLDER WITH PLUGIN FILES & METROFRAMEWORK.dll) + + +***0.5 Changes*** + +- Removed spring effect from Mario Kart 1.10 as it had issues with pulling wheel to side and replaced with constant effect for steering. Added options to enable and disable and modify strength (Do not lower below 128 in ini!!) + +- Added Dpad support for Road Fighters 3D input (read below for details) + +- Added ForceShowDeviceGUIDMessageBox option in ini to force Device Name and Device GUID to show in messagebox popup for each device connected + +- Added option to reverse rumble motors if motors rumbling in reverse to how you like it + + +***0.4 Changes*** + +- Modified Button Rumble plugin to allow 2 x controllers to rumble +(Plugin can be renamed to either dinput8.dll,dinput.dll,d3d9.dll,d3d11.dll,xinput1_3.dll,opengl32.dll or winmm.dll to hook application) + +- Modified Machstorm plugin to allow modifying rumble strength and length if required on effects + +- Modified Afterburner Climax plugin to allow modifying strength and length if required on effects + +- Modified Pokken Tournament plugin to allow modifying strength and length if required on effects (ini contains HowtoRumbleEffect. 0 = both motors, 1 = left motor, 2 = right motor so you can customize to how it suits) + +- Fixed bug on Pokken Tournament where rumble wouldn't work + +- Added rumble support for Let's Go Island (ini contains HowtoRumbleEffect. 0 = both motors, 1 = left motor, 2 = right motor so you can customize to how it suits, supports multiple controllers for 2p) + +- Added rumble support for Let's Go Island 3D (ini contains HowtoRumbleEffect. 0 = both motors, 1 = left motor, 2 = right motor so you can customize to how it suits, supports multiple controllers for 2p) + +- Added FFB Support for San Francisco Rush and San Francisco Rush The Rock for mame 0.199 60fps custom hack version (http://forum.arcadecontrols.com/index.php?topic=158489.0) + + +***0.3 Changes*** + +- Added general button plugin to rumble controller when button pressed, modify length for how long in ini (Great for lightgun games!) + +- Added options to Daytona Championship USA ini to enable or disable Exit Button, Menu Movement or Gear Changes (Teknoparrot version now has this all built in) + +- Added FFB support for Nascar Racing on Demul (180428 version) + +- Added FFB support for GTI Club Supermini Festa on Teknoparrot + +- Added FFB support for Road Fighters 3D using spicetools, added option for input support for analog and buttons. Read bottom of this for details + +- Fixed issue where Sega Racing Classic FFB wouldn't work while playing over network + +- Renamed the log.txt to FFBlog.txt as certain games already created a log.txt which could cause issues + +- Added Daytona USA Multiplayer AI Hack (up to 4 player so far) on M2 Emulator, enable in ini file to enable. While racing network, positions will include AI Car positions too. + +- Added Daytona Force Panoramic Attract option on M2 Emulator to force the game to use panoramic attract mode on less then 4 players even + + +***0.2 Changes*** + +- Added support for California Speed, Cruis'n World, Cruis'n USA & Off Road Challenge on Mame 32 or 64bit Binary OR MameUI64 ONLY for Mame 0.199. + +- Added support for Sega Rally Championship,Daytona USA,Indy 500,Sega Touring Car Championship,Over Rev & Super GT 24h on M2 Emulator 1.1a (just alternative to built in FFB) + (Disable FFB in Emulator.ini if you want to use FFB Plugin instead of M2 Emulator's built in FFB support. Set hardware type to STCC for OverRev & I/O board to A or B for Super GT 24h in test menu!! ) + +- Added support for Initial D4 Japan, Initial D5,Sonic & Sega All Stars Racing & Outrun 2 Special Tours Deluxe for Teknoparrot + +- Added strength options in ini for most effects in Mario Kart 1.10. Wheels can only use MAX of 100, Controller can go higher +Multiplier option is if you want to raise the strength of Water and Drift effects, 200 would double the strength etc. Set to 100 by default + +- Added option to certain games in ini to give a bit more strength to lower forces. FFBMode=0 is the standard and FFBMode=1 is the new mode +(BE WARNED ON CERTAIN WHEELS THIS COULD CAUSE OSCILLATION TO OCCUR) + +- Added option to Daytona Championship USA ini to hide mouse cursor + +- Added AlternativeFFB option to ini which is for wheels such as PWM2M2 or certain direct drive wheels etc which use constant effect incorrectly ingame. +eg Roll left and Roll Right doesn't work correctly, Enable Alternative FFB to modify this and added strength options for it + + +***0.1a Changes*** + +- Added support for San Francisco Rush, San Francisco Rush The Rock, San Francisco Rush 2049, +San Francisco Rush 2049 SE & Rave Racer on Mame 32 or 64bit Binary OR MameUI64 ONLY for Mame 0.199. + + Please turn on Feedback steering in game settings on Rave Racer or you will not recieve FFB & I suggest you + adjust deadzone for your wheel in mame settings. + +(This was added just for a little fun as no one really has done ffb on mame yet) + +- Added Daytona Championship USA exit key (escape), Gear change added for Gears 1,2,3 & 4 or Sequential Gear Up/Down. +Change Button Number in ini if necessary (x360ce not necessary for gear change). +Make ShowButtonNumbersForSetup=1 if you want to have popup boxes to work out Button Layout. Press button to see box +Track selection menu & Name Entry has added control too now + + +- Modified Mario Kart DX 1.10 FFB adding a bunch of new effects and ini can now Enable or Disable Effects +- Will rumble when picking up coins +- Will rumble when picking up weapons +- Will rumble when using weapons +- Drift effect on rumble (stronger the more you turn)(rumble each way when turning etc) +- Boost effect on rumble +- Rumble when kart hits ground from jumps or flying +- Water effect on rumble (rumble each way when turning etc) +- Speed of kart taken into effect etc + +***REQUIREMENTS*** + +- Requires Visual Runtime Files + +- GUI Requires Visual Runtime 2015 (pretty sure its this lol) and has to be in same folder with metroframework.dll & SDL2.dll + +***CREDITS*** + +- Reaver from Teknoparrot . Huge thanks to Reaver for supplying code necessary for some games & general force feedback, +extremely generous. + +- Jackchen for his Daytona Championship USA FFB work at beginning of year. + +- Howard Castro for help on game FFB code. Always helpful and a big reason this plugin was ever made + +- Mame team + +- Racer_S for making dinput8 blocker used on Road Fighters 3D + +- SailorSat for finding the offsets etc required for Daytona USA Multiplayer AI hack + +- Nuexzz for finding offset required for Daytona Panoramic Force Hack + +- POOTERMAN for making logo on GUI + +- Everyone who helps and gives back to this awesome scene. Thanks for everything! + + +***SUPPORTED GAMES*** + +-Afterburner Climax (Rumble only) [opengl32.dll into Teknoparrot folder, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder] + +-Battle Gear 4 Tuned (Japan version v2.07) [d3d9.dll into game exe folder] + +-ChaseHQ 2 [d3d9.dll into game exe folder] + +-Daytona USA [dinput8.dll into m2 emulator 1.1a folder] + +-Daytona Championship USA [dinput8.dll into game exe folder] + +-Ford Racing [dinput8.dll into game exe folder] + +-Indy 500 [dinput8.dll into m2 emulator 1.1a folder] + +-Initial D4 [opengl32.dll into Teknoparrot folder, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder] + +-Initial D4 Japan [opengl32.dll into Teknoparrot folder, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder] + +-Initial D5 [opengl32.dll into Teknoparrot folder, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder] + +-Initial D6 [dinput8.dll into game exe folder] + +-Initial D7 [dinput8.dll into game exe folder] + +-Initial D8 [dinput8.dll into game exe folder] + +-Machstorm (Rumble only) [xinput1_3.dll into game exe folder] + +-Mario Kart GP DX (Version 1.00 & version 1.10) [dinput8.dll into game exe folder] + +-Pokken Tournament (Rumble only) [dinput8.dll into game exe folder] + +-Sega Touring Car Championship [dinput8.dll into m2 emulator 1.1a folder] + +-Sega Racing Classic [dinput8.dll into game exe folder] + +-Sega Rally Championship [dinput8.dll into m2 emulator 1.1a folder] + +-Sega Rally 3 [dinput8.dll into game exe folder] + +-Super GT 24h [dinput8.dll into m2 emulator 1.1a folder] + +-Sonic & Sega All Stars Racing [d3d9.dll into game exe folder] + +-Outrun 2 Special Tours Deluxe [opengl32.dll into Teknoparrot folder, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder] + +-Over Rev [dinput8.dll into m2 emulator 1.1a folder] + +-Wacky Races [d3d9.dll into game exe folder] + +-Wangan Midnight Maximum Tune 5 (Update 5) [d3d11.dll into game exe folder] + +-San Francisco Rush, San Francisco Rush The Rock, San Francisco Rush 2049 & San Francisco Rush 2049 SE +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-Rave Racer [dinput8.dll into any mame 0.199 folder] +TURN ON FEEDBACK STEERING IN GAME SETTINGS OR YOU WILL NOT RECIEVE FORCE FEEDBACK! +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-California Speed +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-Cruis'n World +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-Cruis'n USA +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-Off Road Challenge +(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder] + +-GTI Club Supermini Festa [dinput8.dll into game exe folder] + +-Road Fighters 3D [d3d9.dll & dinput8.dll(if using ffb plugin for inputs) into game exe folder] + +-Nascar Racing [dinput8.dll into demul 180428 version folder] + +-Let's Go Island [d3d9.dll into game exe folder] + +-Let's Go Island 3D [d3d9.dll into game exe folder] + + +***HOW TO USE*** + +Place the main dll file, SDL2.dll & FFBPlugin.ini into game folder for most games. For Teknoparrot Lindbergh +games place opengl32.dll, SDL22.dll into Teknoparrot folder inside Main Teknoparrot folder & FFBPlugin.ini into same folder as elf file for each game. + +Elf file is like the lindbergh version of an exe eg the file you choose to load via teknoparrot + +If using GUI, put FFBPluginGUI.exe & Metroframework.dll into same folder as FFBPlugin.ini + +If you are using FFB Plugin on Teknoparrot instead of using Teknoparrot built in FFB, Please turn off Force Feedback in TeknoparrotUI. (Not necessary on latest TP Versions) + +ini file contains settings to adjust for each game + +GameId= **GameId for code to identify game, also has a test FFB mode,-1 for Constant test ,-2 for +Sine test, -3 for Friction test, -4 for Spring test, -5 for Heavy test or -6 for loose test** + +MinForce= **Minimum FFB force with 0 being lowest value available** + +MaxForce= **Maximum FFB force with 100 being highest value available** + +DeviceGUID= **Set Device GUID to connect to specific wheel or controller** + +EnableRumble= **Turn Off (0) if your wheel supports rumble effect. For controllers, turn on (1)** + +Logging= **Turn On (1) to allow log.txt to be made to log plugin. Device GUID is given in here** + +ResetFeedback= **When a command is set that contradicts a prior command, clear the prior command. Should stay as 1** + +FeedbackLength= **Length of a feedback command** + +DefaultCentering= **If a game does not specify its own Centering force then a default centering can be applied here. +If a game has any of its own such forces,these values will be overwritten immediately in-game. Use -1 to disable** + +DefaultFriction= **If a game does not specify its own Friction force then a default friction can be applied here. +If a game has any of its own such forces,these values will be overwritten immediately in-game. Use -1 to disable** + +BeepWhenHook= **Beep should occur if dll is hooked by executable when turned on (1)** + +FFBMode= **This will raise strength of lower forces, potentially could cause oscillation to occur on certain games. Set 1 to turn on** + +AlternativeFFB= **This is for certain wheels where roll effect does not work correctly normally (such as PWM2M2 or Thrustmaster 300rs etc). Set 1 to turn on ** + +Device2GUID= **Set Device 2 GUID to connect to secondary specific wheel or controller (buttons only)** + + +*** GUI SUPPORT *** + +- REQUIRES visual runtime 2015,SDL2.dll & Metroframework.dll. SDL2.dll & Metroframework.dll are supplied in each plugin folder + +- Is designed to be used in conjunction with FFBPlugin.ini files included with each plugin folder. Place all plugin files into game exe folder(unless Lindbergh, read 0.6a changes above) + +- If FFBPlugin.ini exists, it will read the values and display values etc on game page. As soon as you adjust any value, it automatically writes to FFBPlugin.ini the new value + +- If FFBPlugin.ini doesn't exist it will give you message saying so or if GameId number is missing from FFBPlugin.ini + +- Input support will only work on the supported games, otherwise message will tell you it is unsupported for that games plugin + + +*** INPUT SUPPORT *** + +To enable input on supported games, firstly setup GUID as normal and enable InputDeviceWheelEnable in ini (1 to turn on, 0 to turn off). + +Ive pre-set the axis for Logitech G920 wheel however if this is incorrect I have added options +to change in FFBPlugin.ini. + +- Added option for Device2GUID in ini for a 2nd device to include inputs (great for seperate usb shifter etc, add the button numbers to the device2 buttons in ini ) + +- Enable ShowButtonNumbersForSetup to give window popup to give button numbers for setup into FFBPlugin.ini + +- Enable ShowAxisSetup to give window popup to give axis numbers for setup into FFBPlugin.ini + +- You can enable ShowButtonNumbersForSetup & ShowAxisSetup at same time if you wish + +- SteeringDeadzone to modify the steering deadzone for either wheel or controller. +(Recommend around 2 for wheel and 70 for controller, but feel free to play around for best setting) + +- SequentialGears option will disable standard h pattern gear shift and use leverUp & leverDown to shift up and down gears easily + +- Enable InputDeviceCombinedPedals if your wheel or controller uses combined axis, setup as InputDeviceWheelAcclAxis in ini + +- Set DpadUp,DpadDown,DpadLeft & DpadRight = as any button name in ini eg DpadUp=StartButton and DpadUp will now do start button ingame. You can use Dpad and normal button at same time if you wish + +After setting up Axis and Buttons then Disable ShowButtonNumbersForSetup & ShowAxisSetup if enabled and play! + + +*** TROUBLESHOOTING *** + +OMG FFB DOESN'T WORK!! + +1) Firstly copy files to where supported games section says +2) Run Game then exit after a few seconds +3) Check FFBlog.txt for device guid number +4) Copy this number to FFBPlugin.ini to DeviceGUID= +5) Disable logging in FFBPlugin.ini if you wish for no logging +6) Play Game +7) If still no FFB, ensure you have visual runtime files installed + +INPUT HELP +1) Device does nothing ingame!! (enable InputDeviceWheelEnable) +2) Steering doesn't work (set up correct axis in ini) +3) Pedals don't work (set up correct axis in ini) +4) Pedals only work when not pressed (enable reverse axis) +5) Pedals need to be combined (enable combined pedals) +6) Buttons don't work (set up correct button numbers in ini) +7) Device2 doesn't work (set up correct button numbers in ini under Device2buttons) + +Default Axis and Button Numbers to help with setup on certain controllers/wheels + +For Xbox One & Xbox 360 Controller: +[Axis Numbers] +Left Stick X Axis = 0 +Left Stick Y Axis = 1 +Right Stick X Axis = 3 +Right Stick Y Axis = 4 +Left Trigger = 2 +Right Trigger = 5 + +[Button Numbers] +A Button = 0 +B Button = 1 +X Button = 2 +Y Button = 3 +Left Shoulder Button = 4 +Right Shoulder Button = 5 +Back Button/View Button = 6 +Start Button/Menu Button = 7 +Left Stick Down Button = 8 +Right Stick Down Button = 9 + +For Thrustmaster T300RS: +[Axis Numbers] + +[If Seperate Axis] +Steering Axis = 0 +Accl Axis = 2 +Brake Axis = 1 + +[If Combined Axis] +Steering Axis = 0 +Accl Axis = 1 +Brake Axis = 1 + +[Button Numbers] +PS Button = 12 +L2 Button = 9 +R2 Button = 8 +ST Button = 7 +SE Button = 6 +X Button = 5 +[] Button = 3 +() Button = 4 +/\ Button = 2 +Right Paddle = 1 +Left Paddle = 0 \ No newline at end of file diff --git a/Post-Build/build.js b/Post-Build/build.js new file mode 100644 index 0000000..3d31f3f --- /dev/null +++ b/Post-Build/build.js @@ -0,0 +1,78 @@ +var ini = require('ini'); +var fs = require('fs'); +var myArgs = process.argv.slice(2) || []; +var filename = myArgs.length > 0 ? myArgs[0] : (__dirname + '\\FFBPlugin.ini'); +var sourceDir = myArgs.length > 1 ? myArgs[1] : __dirname; +var outputDir = myArgs.length > 2 ? myArgs[2] : __dirname; + +var o = ini.parse(fs.readFileSync(filename, 'ascii')); +// console.log(JSON.stringify(o) + "\r\n\r\n"); + +var getSettings = function() { + var settings = {}; + Object.keys(o.Settings).forEach(function(k) { + settings[k] = o.Settings[k]; + }); + return settings; +} + +if (fs.existsSync(outputDir + "\\dinput8.dll")) { + console.log("DINPUT8.DLL FOUND"); +} else { + console.log("DINPUT8.DLL NOT FOUND!"); +} + +Object.keys(o).forEach(function(key) { + var output = getSettings(); + var folderName = key; + if (key !== "Settings") { + var realOutput = Object.assign(output, o[key]); + // console.log(JSON.stringify(realOutput) + "\r\n\r\n"); + if (!fs.existsSync(outputDir + '\\' + folderName)) { + fs.mkdirSync(outputDir + "\\" + folderName); + } + console.log("Exporting settings for " + folderName); + fs.writeFileSync(outputDir + "\\" + folderName + "\\FFBPlugin.ini", + "; " + "*".repeat((" *** FFB Settings for" + folderName + " ***").length) + "\r\n" + + "; *** FFB Settings for " + folderName + " ***\r\n" + + "; " + "*".repeat((" *** FFB Settings for" + folderName + " ***").length) + "\r\n" + + ini.stringify({ Settings: realOutput }).trim()); + // try { + // fs.copyFileSync(sourceDir + "\\SDL2.dll", outputDir + "\\" + folderName + "\\SDL2.dll"); + // fs.copyFileSync(sourceDir + "\\dinput8.dll", outputDir + "\\" + folderName + "\\dinput8.dll"); + // } catch(e) { + // // oh well + // } + } +}); + +// var deleteIfExists = function(fn) { +// if (fs.existsSync(fn)) { +// fs.unlinkSync(fn); +// } +// } + +// deleteIfExists(sourceDir + "\\dinput8.exp"); +// deleteIfExists(sourceDir + "\\dinput8.lib"); +// deleteIfExists(sourceDir + "\\dinput8.dll"); +// deleteIfExists(sourceDir + "\\SDL2.dll"); +// deleteIfExists(sourceDir + "\\FFBPlugin.ini"); + +// var deleteFolderRecursive = function(path) { +// if (fs.existsSync(path)) { +// fs.readdirSync(path).forEach(function(file, index){ +// var curPath = path + "/" + file; +// if (fs.lstatSync(curPath).isDirectory()) { // recurse +// deleteFolderRecursive(curPath); +// } else { // delete file +// fs.unlinkSync(curPath); +// } +// }); +// fs.rmdirSync(path); +// } +// } + +// if (fs.existsSync(sourceDir + "DInput8Wrapper\\")) { +// console.log("would delete" + sourceDir + "DInput8Wrapper\\"); +// deleteFolderRecursive(sourceDir + "\\DInput8Wrapper\\"); +// } \ No newline at end of file diff --git a/Post-Build/copydlls.bat b/Post-Build/copydlls.bat new file mode 100644 index 0000000..fd4cc94 --- /dev/null +++ b/Post-Build/copydlls.bat @@ -0,0 +1,5 @@ +cd %1 %2 +for /D /r %%d in (.) do @xcopy *.dll "%%d\" /y +for /D /r %%d in (.) do @xcopy FFBPlugin.txt "%%d\" /y +del %1\*.dll +del %1\FFBPlugin.txt \ No newline at end of file diff --git a/Post-Build/node_modules/ini/LICENSE b/Post-Build/node_modules/ini/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/Post-Build/node_modules/ini/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Post-Build/node_modules/ini/README.md b/Post-Build/node_modules/ini/README.md new file mode 100644 index 0000000..33df258 --- /dev/null +++ b/Post-Build/node_modules/ini/README.md @@ -0,0 +1,102 @@ +An ini format parser and serializer for node. + +Sections are treated as nested objects. Items before the first +heading are saved on the object directly. + +## Usage + +Consider an ini-file `config.ini` that looks like this: + + ; this comment is being ignored + scope = global + + [database] + user = dbuser + password = dbpassword + database = use_this_database + + [paths.default] + datadir = /var/lib/data + array[] = first value + array[] = second value + array[] = third value + +You can read, manipulate and write the ini-file like so: + + var fs = require('fs') + , ini = require('ini') + + var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) + + config.scope = 'local' + config.database.database = 'use_another_database' + config.paths.default.tmpdir = '/tmp' + delete config.paths.default.datadir + config.paths.default.array.push('fourth value') + + fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' })) + +This will result in a file called `config_modified.ini` being written +to the filesystem with the following content: + + [section] + scope=local + [section.database] + user=dbuser + password=dbpassword + database=use_another_database + [section.paths.default] + tmpdir=/tmp + array[]=first value + array[]=second value + array[]=third value + array[]=fourth value + + +## API + +### decode(inistring) + +Decode the ini-style formatted `inistring` into a nested object. + +### parse(inistring) + +Alias for `decode(inistring)` + +### encode(object, [options]) + +Encode the object `object` into an ini-style formatted string. If the +optional parameter `section` is given, then all top-level properties +of the object are put into this section and the `section`-string is +prepended to all sub-sections, see the usage example above. + +The `options` object may contain the following: + +* `section` A string which will be the first `section` in the encoded + ini data. Defaults to none. +* `whitespace` Boolean to specify whether to put whitespace around the + `=` character. By default, whitespace is omitted, to be friendly to + some persnickety old parsers that don't tolerate it well. But some + find that it's more human-readable and pretty with the whitespace. + +For backwards compatibility reasons, if a `string` options is passed +in, then it is assumed to be the `section` value. + +### stringify(object, [options]) + +Alias for `encode(object, [options])` + +### safe(val) + +Escapes the string `val` such that it is safe to be used as a key or +value in an ini-file. Basically escapes quotes. For example + + ini.safe('"unsafe string"') + +would result in + + "\"unsafe string\"" + +### unsafe(val) + +Unescapes the string `val` diff --git a/Post-Build/node_modules/ini/ini.js b/Post-Build/node_modules/ini/ini.js new file mode 100644 index 0000000..590195d --- /dev/null +++ b/Post-Build/node_modules/ini/ini.js @@ -0,0 +1,194 @@ +exports.parse = exports.decode = decode + +exports.stringify = exports.encode = encode + +exports.safe = safe +exports.unsafe = unsafe + +var eol = typeof process !== 'undefined' && + process.platform === 'win32' ? '\r\n' : '\n' + +function encode (obj, opt) { + var children = [] + var out = '' + + if (typeof opt === 'string') { + opt = { + section: opt, + whitespace: false + } + } else { + opt = opt || {} + opt.whitespace = opt.whitespace === true + } + + var separator = opt.whitespace ? ' = ' : '=' + + Object.keys(obj).forEach(function (k, _, __) { + var val = obj[k] + if (val && Array.isArray(val)) { + val.forEach(function (item) { + out += safe(k + '[]') + separator + safe(item) + '\n' + }) + } else if (val && typeof val === 'object') { + children.push(k) + } else { + out += safe(k) + separator + safe(val) + eol + } + }) + + if (opt.section && out.length) { + out = '[' + safe(opt.section) + ']' + eol + out + } + + children.forEach(function (k, _, __) { + var nk = dotSplit(k).join('\\.') + var section = (opt.section ? opt.section + '.' : '') + nk + var child = encode(obj[k], { + section: section, + whitespace: opt.whitespace + }) + if (out.length && child.length) { + out += eol + } + out += child + }) + + return out +} + +function dotSplit (str) { + return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') + .replace(/\\\./g, '\u0001') + .split(/\./).map(function (part) { + return part.replace(/\1/g, '\\.') + .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001') + }) +} + +function decode (str) { + var out = {} + var p = out + var section = null + // section |key = value + var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i + var lines = str.split(/[\r\n]+/g) + + lines.forEach(function (line, _, __) { + if (!line || line.match(/^\s*[;#]/)) return + var match = line.match(re) + if (!match) return + if (match[1] !== undefined) { + section = unsafe(match[1]) + p = out[section] = out[section] || {} + return + } + var key = unsafe(match[2]) + var value = match[3] ? unsafe(match[4]) : true + switch (value) { + case 'true': + case 'false': + case 'null': value = JSON.parse(value) + } + + // Convert keys with '[]' suffix to an array + if (key.length > 2 && key.slice(-2) === '[]') { + key = key.substring(0, key.length - 2) + if (!p[key]) { + p[key] = [] + } else if (!Array.isArray(p[key])) { + p[key] = [p[key]] + } + } + + // safeguard against resetting a previously defined + // array by accidentally forgetting the brackets + if (Array.isArray(p[key])) { + p[key].push(value) + } else { + p[key] = value + } + }) + + // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} + // use a filter to return the keys that have to be deleted. + Object.keys(out).filter(function (k, _, __) { + if (!out[k] || + typeof out[k] !== 'object' || + Array.isArray(out[k])) { + return false + } + // see if the parent section is also an object. + // if so, add it to that, and mark this one for deletion + var parts = dotSplit(k) + var p = out + var l = parts.pop() + var nl = l.replace(/\\\./g, '.') + parts.forEach(function (part, _, __) { + if (!p[part] || typeof p[part] !== 'object') p[part] = {} + p = p[part] + }) + if (p === out && nl === l) { + return false + } + p[nl] = out[k] + return true + }).forEach(function (del, _, __) { + delete out[del] + }) + + return out +} + +function isQuoted (val) { + return (val.charAt(0) === '"' && val.slice(-1) === '"') || + (val.charAt(0) === "'" && val.slice(-1) === "'") +} + +function safe (val) { + return (typeof val !== 'string' || + val.match(/[=\r\n]/) || + val.match(/^\[/) || + (val.length > 1 && + isQuoted(val)) || + val !== val.trim()) + ? JSON.stringify(val) + : val.replace(/;/g, '\\;').replace(/#/g, '\\#') +} + +function unsafe (val, doUnesc) { + val = (val || '').trim() + if (isQuoted(val)) { + // remove the single quotes before calling JSON.parse + if (val.charAt(0) === "'") { + val = val.substr(1, val.length - 2) + } + try { val = JSON.parse(val) } catch (_) {} + } else { + // walk the val to find the first not-escaped ; character + var esc = false + var unesc = '' + for (var i = 0, l = val.length; i < l; i++) { + var c = val.charAt(i) + if (esc) { + if ('\\;#'.indexOf(c) !== -1) { + unesc += c + } else { + unesc += '\\' + c + } + esc = false + } else if (';#'.indexOf(c) !== -1) { + break + } else if (c === '\\') { + esc = true + } else { + unesc += c + } + } + if (esc) { + unesc += '\\' + } + return unesc.trim() + } + return val +} diff --git a/Post-Build/node_modules/ini/package.json b/Post-Build/node_modules/ini/package.json new file mode 100644 index 0000000..6b871db --- /dev/null +++ b/Post-Build/node_modules/ini/package.json @@ -0,0 +1,66 @@ +{ + "_args": [ + [ + "ini@1.3.5", + "C:\\Users\\booms\\Downloads\\pragun89-ffbplugin-9321a2abeb0d-fixedX64\\Post-Build" + ] + ], + "_from": "ini@1.3.5", + "_id": "ini@1.3.5", + "_inBundle": false, + "_integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "_location": "/ini", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ini@1.3.5", + "name": "ini", + "escapedName": "ini", + "rawSpec": "1.3.5", + "saveSpec": null, + "fetchSpec": "1.3.5" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "_spec": "1.3.5", + "_where": "C:\\Users\\booms\\Downloads\\pragun89-ffbplugin-9321a2abeb0d-fixedX64\\Post-Build", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/ini/issues" + }, + "dependencies": {}, + "description": "An ini encoder/decoder for node", + "devDependencies": { + "standard": "^10.0.3", + "tap": "^10.7.3 || 11" + }, + "engines": { + "node": "*" + }, + "files": [ + "ini.js" + ], + "homepage": "https://github.com/isaacs/ini#readme", + "license": "ISC", + "main": "ini.js", + "name": "ini", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/ini.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "pretest": "standard ini.js", + "preversion": "npm test", + "test": "tap test/*.js --100 -J" + }, + "version": "1.3.5" +} diff --git a/Post-Build/package-lock.json b/Post-Build/package-lock.json new file mode 100644 index 0000000..0dd9568 --- /dev/null +++ b/Post-Build/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "ffb-build", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + } + } +} diff --git a/Post-Build/package.json b/Post-Build/package.json new file mode 100644 index 0000000..6c43c6b --- /dev/null +++ b/Post-Build/package.json @@ -0,0 +1,14 @@ +{ + "name": "ffb-build", + "version": "0.0.1", + "description": "Post-build process operations for ffbplugin", + "main": "build.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "spazzy", + "license": "ISC", + "dependencies": { + "ini": "^1.3.5" + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9ef0bd --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# FFBPlugin + +C++ plugin for adding force feedback support to arcade games. \ No newline at end of file diff --git a/dinput8.def b/dinput8.def new file mode 100644 index 0000000..dabe8b0 --- /dev/null +++ b/dinput8.def @@ -0,0 +1,658 @@ +LIBRARY dinput8 +EXPORTS + DllMain @1 + XInputGetState = _XInputGetState @2 + XInputSetState = _XInputSetState @3 + XInputGetCapabilities = _XInputGetCapabilities @4 + XInputEnable = _XInputEnable @5 + XInputGetDSoundAudioDeviceGuids = _XInputGetDSoundAudioDeviceGuids @6 + XInputGetBatteryInformation = _XInputGetBatteryInformation @7 + XInputGetKeystroke = _XInputGetKeystroke @8 + XInputGetStateEx = _XInputGetStateEx @100 NONAME + XInputWaitForGuideButton = _XInputWaitForGuideButton @101 NONAME + XInputCancelGuideButtonWait = _XInputCancelGuideButtonWait @102 NONAME + XInputPowerOffController = _XInputPowerOffController @103 NONAME + + DirectInput8Create=DirectInputDirectInput8Create + DllRegisterServer=DirectInputDllRegisterServer PRIVATE + DllUnregisterServer=DirectInputDllUnregisterServer PRIVATE + DllCanUnloadNow=DirectInputDllCanUnloadNow PRIVATE + DllGetClassObject=DirectInputDllGetClassObject PRIVATE + GetdfDIJoystick=DirectInputGetdfDIJoystick PRIVATE + + DirectInputCreateA=DirectInputDirectInputCreateA + DirectInputCreateW=DirectInputDirectInputCreateW + DirectInputCreateEx=DirectInputDirectInputCreateEx + + Direct3DShaderValidatorCreate9 = _Direct3DShaderValidatorCreate9 @19 + PSGPError = _PSGPError @20 + PSGPSampleTexture = _PSGPSampleTexture @21 + D3DPERF_BeginEvent = _D3DPERF_BeginEvent @22 + D3DPERF_EndEvent = _D3DPERF_EndEvent @23 + D3DPERF_GetStatus = _D3DPERF_GetStatus @24 + D3DPERF_QueryRepeatFrame = _D3DPERF_QueryRepeatFrame @25 + D3DPERF_SetMarker = _D3DPERF_SetMarker @26 + D3DPERF_SetOptions = _D3DPERF_SetOptions @27 + D3DPERF_SetRegion = _D3DPERF_SetRegion @28 + DebugSetLevel = _DebugSetLevel @29 + DebugSetMute = _DebugSetMute @30 + Direct3D9EnableMaximizedWindowedModeShim = _Direct3D9EnableMaximizedWindowedModeShim @31 + Direct3DCreate9 = _Direct3DCreate9 @32 + Direct3DCreate9Ex = _Direct3DCreate9Ex @33 + + D3D11CreateDeviceForD3D12 = _D3D11CreateDeviceForD3D12 + D3DKMTCloseAdapter = _D3DKMTCloseAdapter + D3DKMTDestroyAllocation = _D3DKMTDestroyAllocation + D3DKMTDestroyContext = _D3DKMTDestroyContext + D3DKMTDestroyDevice = _D3DKMTDestroyDevice + D3DKMTDestroySynchronizationObject = _D3DKMTDestroySynchronizationObject + D3DKMTPresent = _D3DKMTPresent + D3DKMTQueryAdapterInfo = _D3DKMTQueryAdapterInfo + D3DKMTSetDisplayPrivateDriverFormat = _D3DKMTSetDisplayPrivateDriverFormat + D3DKMTSignalSynchronizationObject = _D3DKMTSignalSynchronizationObject + D3DKMTUnlock = _D3DKMTUnlock + D3DKMTWaitForSynchronizationObject = _D3DKMTWaitForSynchronizationObject + EnableFeatureLevelUpgrade = _EnableFeatureLevelUpgrade + OpenAdapter10 = _OpenAdapter10 + OpenAdapter10_2 = _OpenAdapter10_2 + CreateDirect3D11DeviceFromDXGIDevice = _CreateDirect3D11DeviceFromDXGIDevice + CreateDirect3D11SurfaceFromDXGISurface = _CreateDirect3D11SurfaceFromDXGISurface + D3D11CoreCreateDevice = _D3D11CoreCreateDevice + D3D11CoreCreateLayeredDevice = _D3D11CoreCreateLayeredDevice + D3D11CoreGetLayeredDeviceSize = _D3D11CoreGetLayeredDeviceSize + D3D11CoreRegisterLayers = _D3D11CoreRegisterLayers + D3D11CreateDevice = _D3D11CreateDevice + D3D11CreateDeviceAndSwapChain = _D3D11CreateDeviceAndSwapChain + D3D11On12CreateDevice = _D3D11On12CreateDevice + D3DKMTCreateAllocation = _D3DKMTCreateAllocation + D3DKMTCreateContext = _D3DKMTCreateContext + D3DKMTCreateDevice = _D3DKMTCreateDevice + D3DKMTCreateSynchronizationObject = _D3DKMTCreateSynchronizationObject + D3DKMTEscape = _D3DKMTEscape + D3DKMTGetContextSchedulingPriority = _D3DKMTGetContextSchedulingPriority + D3DKMTGetDeviceState = _D3DKMTGetDeviceState + D3DKMTGetDisplayModeList = _D3DKMTGetDisplayModeList + D3DKMTGetMultisampleMethodList = _D3DKMTGetMultisampleMethodList + D3DKMTGetRuntimeData = _D3DKMTGetRuntimeData + D3DKMTGetSharedPrimaryHandle = _D3DKMTGetSharedPrimaryHandle + D3DKMTLock = _D3DKMTLock + D3DKMTOpenAdapterFromHdc = _D3DKMTOpenAdapterFromHdc + D3DKMTOpenResource = _D3DKMTOpenResource + D3DKMTQueryAllocationResidency = _D3DKMTQueryAllocationResidency + D3DKMTQueryResourceInfo = _D3DKMTQueryResourceInfo + D3DKMTRender = _D3DKMTRender + D3DKMTSetAllocationPriority = _D3DKMTSetAllocationPriority + D3DKMTSetContextSchedulingPriority = _D3DKMTSetContextSchedulingPriority + D3DKMTSetDisplayMode = _D3DKMTSetDisplayMode + D3DKMTSetGammaRamp = _D3DKMTSetGammaRamp + D3DKMTSetVidPnSourceOwner = _D3DKMTSetVidPnSourceOwner + D3DKMTWaitForVerticalBlankEvent = _D3DKMTWaitForVerticalBlankEvent + D3DPerformance_BeginEvent = _D3DPerformance_BeginEvent + D3DPerformance_EndEvent = _D3DPerformance_EndEvent + D3DPerformance_GetStatus = _D3DPerformance_GetStatus + D3DPerformance_SetMarker = _D3DPerformance_SetMarker + + wglUseFontOutlinesA = _wglUseFontOutlinesA + wglUseFontOutlinesW = _wglUseFontOutlinesW + wglDescribeLayerPlane = _wglDescribeLayerPlane + wglSetLayerPaletteEntries = _wglSetLayerPaletteEntries + wglGetLayerPaletteEntries = _wglGetLayerPaletteEntries + wglRealizeLayerPalette = _wglRealizeLayerPalette + wglSwapLayerBuffers = _wglSwapLayerBuffers + wglMakeCurrent = _wglMakeCurrent + GlmfInitPlayback = _GlmfInitPlayback + GlmfBeginGlsBlock = _GlmfBeginGlsBlock + GlmfPlayGlsRecord = _GlmfPlayGlsRecord + GlmfEndGlsBlock = _GlmfEndGlsBlock + GlmfEndPlayback = _GlmfEndPlayback + GlmfCloseMetaFile = _GlmfCloseMetaFile + wglSwapMultipleBuffers = _wglSwapMultipleBuffers + wglCreateLayerContext = _wglCreateLayerContext + wglCreateContext = _wglCreateContext + wglDeleteContext = _wglDeleteContext + wglGetCurrentContext = _wglGetCurrentContext + wglGetCurrentDC = _wglGetCurrentDC + wglUseFontBitmapsA = _wglUseFontBitmapsA + wglUseFontBitmapsW = _wglUseFontBitmapsW + wglShareLists = _wglShareLists + wglGetDefaultProcAddress = _wglGetDefaultProcAddress + wglGetProcAddress = _wglGetProcAddress + wglCopyContext = _wglCopyContext + glDebugEntry = _glDebugEntry + wglGetPixelFormat = _wglGetPixelFormat + wglSetPixelFormat = _wglSetPixelFormat + wglChoosePixelFormat = _wglChoosePixelFormat + wglDescribePixelFormat = _wglDescribePixelFormat + wglSwapBuffers = _wglSwapBuffers + glCallList = _glCallList + glCallLists = _glCallLists + glBegin = _glBegin + glColor3b = _glColor3b + glColor3bv = _glColor3bv + glColor3d = _glColor3d + glColor3dv = _glColor3dv + glColor3f = _glColor3f + glColor3fv = _glColor3fv + glColor3i = _glColor3i + glColor3iv = _glColor3iv + glColor3s = _glColor3s + glColor3sv = _glColor3sv + glColor3ub = _glColor3ub + glColor3ubv = _glColor3ubv + glColor3ui = _glColor3ui + glColor3uiv = _glColor3uiv + glColor3us = _glColor3us + glColor3usv = _glColor3usv + glColor4b = _glColor4b + glColor4bv = _glColor4bv + glColor4d = _glColor4d + glColor4dv = _glColor4dv + glColor4f = _glColor4f + glColor4fv = _glColor4fv + glColor4i = _glColor4i + glColor4iv = _glColor4iv + glColor4s = _glColor4s + glColor4sv = _glColor4sv + glColor4ub = _glColor4ub + glColor4ubv = _glColor4ubv + glColor4ui = _glColor4ui + glColor4uiv = _glColor4uiv + glColor4us = _glColor4us + glColor4usv = _glColor4usv + glEdgeFlag = _glEdgeFlag + glEdgeFlagv = _glEdgeFlagv + glEnd = _glEnd + glIndexd = _glIndexd + glIndexdv = _glIndexdv + glIndexf = _glIndexf + glIndexfv = _glIndexfv + glIndexi = _glIndexi + glIndexiv = _glIndexiv + glIndexs = _glIndexs + glIndexsv = _glIndexsv + glNormal3b = _glNormal3b + glNormal3bv = _glNormal3bv + glNormal3d = _glNormal3d + glNormal3dv = _glNormal3dv + glNormal3f = _glNormal3f + glNormal3fv = _glNormal3fv + glNormal3i = _glNormal3i + glNormal3iv = _glNormal3iv + glNormal3s = _glNormal3s + glNormal3sv = _glNormal3sv + glTexCoord1d = _glTexCoord1d + glTexCoord1dv = _glTexCoord1dv + glTexCoord1f = _glTexCoord1f + glTexCoord1fv = _glTexCoord1fv + glTexCoord1i = _glTexCoord1i + glTexCoord1iv = _glTexCoord1iv + glTexCoord1s = _glTexCoord1s + glTexCoord1sv = _glTexCoord1sv + glTexCoord2d = _glTexCoord2d + glTexCoord2dv = _glTexCoord2dv + glTexCoord2f = _glTexCoord2f + glTexCoord2fv = _glTexCoord2fv + glTexCoord2i = _glTexCoord2i + glTexCoord2iv = _glTexCoord2iv + glTexCoord2s = _glTexCoord2s + glTexCoord2sv = _glTexCoord2sv + glTexCoord3d = _glTexCoord3d + glTexCoord3dv = _glTexCoord3dv + glTexCoord3f = _glTexCoord3f + glTexCoord3fv = _glTexCoord3fv + glTexCoord3i = _glTexCoord3i + glTexCoord3iv = _glTexCoord3iv + glTexCoord3s = _glTexCoord3s + glTexCoord3sv = _glTexCoord3sv + glTexCoord4d = _glTexCoord4d + glTexCoord4dv = _glTexCoord4dv + glTexCoord4f = _glTexCoord4f + glTexCoord4fv = _glTexCoord4fv + glTexCoord4i = _glTexCoord4i + glTexCoord4iv = _glTexCoord4iv + glTexCoord4s = _glTexCoord4s + glTexCoord4sv = _glTexCoord4sv + glVertex2d = _glVertex2d + glVertex2dv = _glVertex2dv + glVertex2f = _glVertex2f + glVertex2fv = _glVertex2fv + glVertex2i = _glVertex2i + glVertex2iv = _glVertex2iv + glVertex2s = _glVertex2s + glVertex2sv = _glVertex2sv + glVertex3d = _glVertex3d + glVertex3dv = _glVertex3dv + glVertex3f = _glVertex3f + glVertex3fv = _glVertex3fv + glVertex3i = _glVertex3i + glVertex3iv = _glVertex3iv + glVertex3s = _glVertex3s + glVertex3sv = _glVertex3sv + glVertex4d = _glVertex4d + glVertex4dv = _glVertex4dv + glVertex4f = _glVertex4f + glVertex4fv = _glVertex4fv + glVertex4i = _glVertex4i + glVertex4iv = _glVertex4iv + glVertex4s = _glVertex4s + glVertex4sv = _glVertex4sv + glMaterialf = _glMaterialf + glMaterialfv = _glMaterialfv + glMateriali = _glMateriali + glMaterialiv = _glMaterialiv + glDisable = _glDisable + glEnable = _glEnable + glPopAttrib = _glPopAttrib + glPushAttrib = _glPushAttrib + glEvalCoord1d = _glEvalCoord1d + glEvalCoord1dv = _glEvalCoord1dv + glEvalCoord1f = _glEvalCoord1f + glEvalCoord1fv = _glEvalCoord1fv + glEvalCoord2d = _glEvalCoord2d + glEvalCoord2dv = _glEvalCoord2dv + glEvalCoord2f = _glEvalCoord2f + glEvalCoord2fv = _glEvalCoord2fv + glEvalPoint1 = _glEvalPoint1 + glEvalPoint2 = _glEvalPoint2 + glLoadIdentity = _glLoadIdentity + glLoadMatrixf = _glLoadMatrixf + glLoadMatrixd = _glLoadMatrixd + glMatrixMode = _glMatrixMode + glMultMatrixf = _glMultMatrixf + glMultMatrixd = _glMultMatrixd + glPopMatrix = _glPopMatrix + glPushMatrix = _glPushMatrix + glRotated = _glRotated + glRotatef = _glRotatef + glScaled = _glScaled + glScalef = _glScalef + glTranslated = _glTranslated + glTranslatef = _glTranslatef + glArrayElement = _glArrayElement + glBindTexture = _glBindTexture + glColorPointer = _glColorPointer + glDisableClientState = _glDisableClientState + glDrawArrays = _glDrawArrays + glDrawElements = _glDrawElements + glEdgeFlagPointer = _glEdgeFlagPointer + glEnableClientState = _glEnableClientState + glIndexPointer = _glIndexPointer + glIndexub = _glIndexub + glIndexubv = _glIndexubv + glInterleavedArrays = _glInterleavedArrays + glNormalPointer = _glNormalPointer + glPolygonOffset = _glPolygonOffset + glTexCoordPointer = _glTexCoordPointer + glVertexPointer = _glVertexPointer + glGetPointerv = _glGetPointerv + glPopClientAttrib = _glPopClientAttrib + glPushClientAttrib = _glPushClientAttrib + glClear = _glClear + glClearAccum = _glClearAccum + glClearIndex = _glClearIndex + glClearColor = _glClearColor + glClearStencil = _glClearStencil + glClearDepth = _glClearDepth + glBitmap = _glBitmap + glTexImage1D = _glTexImage1D + glTexImage2D = _glTexImage2D + glCopyPixels = _glCopyPixels + glReadPixels = _glReadPixels + glDrawPixels = _glDrawPixels + glRectd = _glRectd + glRectdv = _glRectdv + glRectf = _glRectf + glRectfv = _glRectfv + glRecti = _glRecti + glRectiv = _glRectiv + glRects = _glRects + glRectsv = _glRectsv + glNewList = _glNewList + glEndList = _glEndList + glDeleteLists = _glDeleteLists + glGenLists = _glGenLists + glListBase = _glListBase + glRasterPos2d = _glRasterPos2d + glRasterPos2dv = _glRasterPos2dv + glRasterPos2f = _glRasterPos2f + glRasterPos2fv = _glRasterPos2fv + glRasterPos2i = _glRasterPos2i + glRasterPos2iv = _glRasterPos2iv + glRasterPos2s = _glRasterPos2s + glRasterPos2sv = _glRasterPos2sv + glRasterPos3d = _glRasterPos3d + glRasterPos3dv = _glRasterPos3dv + glRasterPos3f = _glRasterPos3f + glRasterPos3fv = _glRasterPos3fv + glRasterPos3i = _glRasterPos3i + glRasterPos3iv = _glRasterPos3iv + glRasterPos3s = _glRasterPos3s + glRasterPos3sv = _glRasterPos3sv + glRasterPos4d = _glRasterPos4d + glRasterPos4dv = _glRasterPos4dv + glRasterPos4f = _glRasterPos4f + glRasterPos4fv = _glRasterPos4fv + glRasterPos4i = _glRasterPos4i + glRasterPos4iv = _glRasterPos4iv + glRasterPos4s = _glRasterPos4s + glRasterPos4sv = _glRasterPos4sv + glClipPlane = _glClipPlane + glColorMaterial = _glColorMaterial + glCullFace = _glCullFace + glFogf = _glFogf + glFogfv = _glFogfv + glFogi = _glFogi + glFogiv = _glFogiv + glFrontFace = _glFrontFace + glHint = _glHint + glLightf = _glLightf + glLightfv = _glLightfv + glLighti = _glLighti + glLightiv = _glLightiv + glLightModelf = _glLightModelf + glLightModelfv = _glLightModelfv + glLightModeli = _glLightModeli + glLightModeliv = _glLightModeliv + glLineStipple = _glLineStipple + glLineWidth = _glLineWidth + glPointSize = _glPointSize + glPolygonMode = _glPolygonMode + glPolygonStipple = _glPolygonStipple + glScissor = _glScissor + glFinish = _glFinish + glShadeModel = _glShadeModel + glTexParameterf = _glTexParameterf + glTexParameterfv = _glTexParameterfv + glTexParameteri = _glTexParameteri + glTexParameteriv = _glTexParameteriv + glTexEnvf = _glTexEnvf + glTexEnvfv = _glTexEnvfv + glTexEnvi = _glTexEnvi + glTexEnviv = _glTexEnviv + glTexGend = _glTexGend + glTexGendv = _glTexGendv + glTexGenf = _glTexGenf + glTexGenfv = _glTexGenfv + glTexGeni = _glTexGeni + glTexGeniv = _glTexGeniv + glFeedbackBuffer = _glFeedbackBuffer + glSelectBuffer = _glSelectBuffer + glRenderMode = _glRenderMode + glInitNames = _glInitNames + glLoadName = _glLoadName + glPassThrough = _glPassThrough + glPopName = _glPopName + glPushName = _glPushName + glDrawBuffer = _glDrawBuffer + glStencilMask = _glStencilMask + glColorMask = _glColorMask + glDepthMask = _glDepthMask + glIndexMask = _glIndexMask + glAccum = _glAccum + glFlush = _glFlush + glMap1d = _glMap1d + glMap1f = _glMap1f + glMap2d = _glMap2d + glMap2f = _glMap2f + glMapGrid1d = _glMapGrid1d + glMapGrid1f = _glMapGrid1f + glMapGrid2d = _glMapGrid2d + glMapGrid2f = _glMapGrid2f + glEvalMesh1 = _glEvalMesh1 + glEvalMesh2 = _glEvalMesh2 + glAlphaFunc = _glAlphaFunc + glBlendFunc = _glBlendFunc + glLogicOp = _glLogicOp + glStencilFunc = _glStencilFunc + glStencilOp = _glStencilOp + glDepthFunc = _glDepthFunc + glPixelZoom = _glPixelZoom + glPixelTransferf = _glPixelTransferf + glPixelTransferi = _glPixelTransferi + glPixelStoref = _glPixelStoref + glPixelStorei = _glPixelStorei + glPixelMapfv = _glPixelMapfv + glPixelMapuiv = _glPixelMapuiv + glPixelMapusv = _glPixelMapusv + glReadBuffer = _glReadBuffer + glGetBooleanv = _glGetBooleanv + glGetClipPlane = _glGetClipPlane + glGetDoublev = _glGetDoublev + glGetError = _glGetError + glGetFloatv = _glGetFloatv + glGetIntegerv = _glGetIntegerv + glGetLightfv = _glGetLightfv + glGetLightiv = _glGetLightiv + glGetMapdv = _glGetMapdv + glGetMapfv = _glGetMapfv + glGetMapiv = _glGetMapiv + glGetMaterialfv = _glGetMaterialfv + glGetMaterialiv = _glGetMaterialiv + glGetPixelMapfv = _glGetPixelMapfv + glGetPixelMapuiv = _glGetPixelMapuiv + glGetPixelMapusv = _glGetPixelMapusv + glGetPolygonStipple = _glGetPolygonStipple + glGetString = _glGetString + glGetTexEnvfv = _glGetTexEnvfv + glGetTexEnviv = _glGetTexEnviv + glGetTexGendv = _glGetTexGendv + glGetTexGenfv = _glGetTexGenfv + glGetTexGeniv = _glGetTexGeniv + glGetTexImage = _glGetTexImage + glGetTexParameterfv = _glGetTexParameterfv + glGetTexParameteriv = _glGetTexParameteriv + glGetTexLevelParameterfv = _glGetTexLevelParameterfv + glGetTexLevelParameteriv = _glGetTexLevelParameteriv + glIsEnabled = _glIsEnabled + glIsList = _glIsList + glDepthRange = _glDepthRange + glFrustum = _glFrustum + glOrtho = _glOrtho + glViewport = _glViewport + glAreTexturesResident = _glAreTexturesResident + glCopyTexImage1D = _glCopyTexImage1D + glCopyTexImage2D = _glCopyTexImage2D + glCopyTexSubImage1D = _glCopyTexSubImage1D + glCopyTexSubImage2D = _glCopyTexSubImage2D + glDeleteTextures = _glDeleteTextures + glGenTextures = _glGenTextures + glIsTexture = _glIsTexture + glPrioritizeTextures = _glPrioritizeTextures + glTexSubImage1D = _glTexSubImage1D + glTexSubImage2D = _glTexSubImage2D + + PlaySoundW = _PlaySoundW + timeSetEvent = _timeSetEvent + timeKillEvent = _timeKillEvent + midiOutMessage = _midiOutMessage + timeBeginPeriod = _timeBeginPeriod + timeGetTime = _timeGetTime + NotifyCallbackData = _NotifyCallbackData + WOW32DriverCallback = _WOW32DriverCallback + WOW32ResolveMultiMediaHandle = _WOW32ResolveMultiMediaHandle + aux32Message = _aux32Message + joy32Message = _joy32Message + mid32Message = _mid32Message + mod32Message = _mod32Message + mxd32Message = _mxd32Message + tid32Message = _tid32Message + wid32Message = _wid32Message + wod32Message = _wod32Message + mci32Message = _mci32Message + CloseDriver = _CloseDriver + DefDriverProc = _DefDriverProc + DriverCallback = _DriverCallback + DrvGetModuleHandle = _DrvGetModuleHandle + GetDriverModuleHandle = _GetDriverModuleHandle + OpenDriver = _OpenDriver + PlaySound = _PlaySound + Ordinal2 = _Ordinal2 + SendDriverMessage = _SendDriverMessage + auxGetDevCapsA = _auxGetDevCapsA + auxGetDevCapsW = _auxGetDevCapsW + auxGetNumDevs = _auxGetNumDevs + auxGetVolume = _auxGetVolume + auxOutMessage = _auxOutMessage + auxSetVolume = _auxSetVolume + joyConfigChanged = _joyConfigChanged + joyGetDevCapsA = _joyGetDevCapsA + joyGetDevCapsW = _joyGetDevCapsW + joyGetNumDevs = _joyGetNumDevs + joyGetPosEx = _joyGetPosEx + joyGetPos = _joyGetPos + joyGetThreshold = _joyGetThreshold + joyReleaseCapture = _joyReleaseCapture + joySetCapture = _joySetCapture + joySetThreshold = _joySetThreshold + midiConnect = _midiConnect + midiDisconnect = _midiDisconnect + midiInAddBuffer = _midiInAddBuffer + midiInClose = _midiInClose + midiInGetDevCapsA = _midiInGetDevCapsA + midiInGetDevCapsW = _midiInGetDevCapsW + midiInGetErrorTextA = _midiInGetErrorTextA + midiInGetErrorTextW = _midiInGetErrorTextW + midiInGetID = _midiInGetID + midiInGetNumDevs = _midiInGetNumDevs + midiInMessage = _midiInMessage + midiInOpen = _midiInOpen + midiInPrepareHeader = _midiInPrepareHeader + midiInReset = _midiInReset + midiInStart = _midiInStart + midiInStop = _midiInStop + midiInUnprepareHeader = _midiInUnprepareHeader + midiOutCacheDrumPatches = _midiOutCacheDrumPatches + midiOutCachePatches = _midiOutCachePatches + midiOutClose = _midiOutClose + midiOutGetDevCapsA = _midiOutGetDevCapsA + midiOutGetDevCapsW = _midiOutGetDevCapsW + midiOutGetErrorTextA = _midiOutGetErrorTextA + midiOutGetErrorTextW = _midiOutGetErrorTextW + midiOutGetID = _midiOutGetID + midiOutGetNumDevs = _midiOutGetNumDevs + midiOutGetVolume = _midiOutGetVolume + midiOutLongMsg = _midiOutLongMsg + midiOutOpen = _midiOutOpen + midiOutPrepareHeader = _midiOutPrepareHeader + midiOutReset = _midiOutReset + midiOutSetVolume = _midiOutSetVolume + midiOutShortMsg = _midiOutShortMsg + midiOutUnprepareHeader = _midiOutUnprepareHeader + midiStreamClose = _midiStreamClose + midiStreamOpen = _midiStreamOpen + midiStreamOut = _midiStreamOut + midiStreamPause = _midiStreamPause + midiStreamPosition = _midiStreamPosition + midiStreamProperty = _midiStreamProperty + midiStreamRestart = _midiStreamRestart + midiStreamStop = _midiStreamStop + mixerClose = _mixerClose + mixerGetControlDetailsA = _mixerGetControlDetailsA + mixerGetControlDetailsW = _mixerGetControlDetailsW + mixerGetDevCapsA = _mixerGetDevCapsA + mixerGetDevCapsW = _mixerGetDevCapsW + mixerGetID = _mixerGetID + mixerGetLineControlsA = _mixerGetLineControlsA + mixerGetLineControlsW = _mixerGetLineControlsW + mixerGetLineInfoA = _mixerGetLineInfoA + mixerGetLineInfoW = _mixerGetLineInfoW + mixerGetNumDevs = _mixerGetNumDevs + mixerMessage = _mixerMessage + mixerOpen = _mixerOpen + mixerSetControlDetails = _mixerSetControlDetails + mmDrvInstall = _mmDrvInstall + mmGetCurrentTask = _mmGetCurrentTask + mmTaskBlock = _mmTaskBlock + mmTaskCreate = _mmTaskCreate + mmTaskSignal = _mmTaskSignal + mmTaskYield = _mmTaskYield + mmioAdvance = _mmioAdvance + mmioAscend = _mmioAscend + mmioClose = _mmioClose + mmioCreateChunk = _mmioCreateChunk + mmioDescend = _mmioDescend + mmioFlush = _mmioFlush + mmioGetInfo = _mmioGetInfo + mmioInstallIOProcA = _mmioInstallIOProcA + mmioInstallIOProcW = _mmioInstallIOProcW + mmioOpenA = _mmioOpenA + mmioOpenW = _mmioOpenW + mmioRead = _mmioRead + mmioRenameA = _mmioRenameA + mmioRenameW = _mmioRenameW + mmioSeek = _mmioSeek + mmioSendMessage = _mmioSendMessage + mmioSetBuffer = _mmioSetBuffer + mmioSetInfo = _mmioSetInfo + mmioStringToFOURCCA = _mmioStringToFOURCCA + mmioStringToFOURCCW = _mmioStringToFOURCCW + mmioWrite = _mmioWrite + timeEndPeriod = _timeEndPeriod + timeGetDevCaps = _timeGetDevCaps + timeGetSystemTime = _timeGetSystemTime + waveInAddBuffer = _waveInAddBuffer + waveInClose = _waveInClose + waveInGetDevCapsA = _waveInGetDevCapsA + waveInGetDevCapsW = _waveInGetDevCapsW + waveInGetErrorTextA = _waveInGetErrorTextA + waveInGetErrorTextW = _waveInGetErrorTextW + waveInGetID = _waveInGetID + waveInGetNumDevs = _waveInGetNumDevs + waveInGetPosition = _waveInGetPosition + waveInMessage = _waveInMessage + waveInOpen = _waveInOpen + waveInPrepareHeader = _waveInPrepareHeader + waveInReset = _waveInReset + waveInStart = _waveInStart + waveInStop = _waveInStop + waveInUnprepareHeader = _waveInUnprepareHeader + waveOutBreakLoop = _waveOutBreakLoop + waveOutClose = _waveOutClose + waveOutGetDevCapsA = _waveOutGetDevCapsA + waveOutGetDevCapsW = _waveOutGetDevCapsW + waveOutGetErrorTextA = _waveOutGetErrorTextA + waveOutGetErrorTextW = _waveOutGetErrorTextW + waveOutGetID = _waveOutGetID + waveOutGetNumDevs = _waveOutGetNumDevs + waveOutGetPitch = _waveOutGetPitch + waveOutGetPlaybackRate = _waveOutGetPlaybackRate + waveOutGetPosition = _waveOutGetPosition + waveOutGetVolume = _waveOutGetVolume + waveOutMessage = _waveOutMessage + waveOutOpen = _waveOutOpen + waveOutPause = _waveOutPause + waveOutPrepareHeader = _waveOutPrepareHeader + waveOutReset = _waveOutReset + waveOutRestart = _waveOutRestart + waveOutSetPitch = _waveOutSetPitch + waveOutSetPlaybackRate = _waveOutSetPlaybackRate + waveOutSetVolume = _waveOutSetVolume + waveOutUnprepareHeader = _waveOutUnprepareHeader + waveOutWrite = _waveOutWrite + mciExecute = _mciExecute + mciGetErrorStringA = _mciGetErrorStringA + mciGetErrorStringW = _mciGetErrorStringW + mciSendCommandA = _mciSendCommandA + mciSendCommandW = _mciSendCommandW + mciSendStringA = _mciSendStringA + mciSendStringW = _mciSendStringW + mciFreeCommandResource = _mciFreeCommandResource + mciLoadCommandResource = _mciLoadCommandResource + mciDriverNotify = _mciDriverNotify + mciDriverYield = _mciDriverYield + mciGetCreatorTask = _mciGetCreatorTask + mciGetDeviceIDA = _mciGetDeviceIDA + mciGetDeviceIDFromElementIDA = _mciGetDeviceIDFromElementIDA + mciGetDeviceIDFromElementIDW = _mciGetDeviceIDFromElementIDW + mciGetDeviceIDW = _mciGetDeviceIDW + mciGetDriverData = _mciGetDriverData + mciGetYieldProc = _mciGetYieldProc + mciSetDriverData = _mciSetDriverData + mciSetYieldProc = _mciSetYieldProc + PlaySoundA = _PlaySoundA + sndPlaySoundA = _sndPlaySoundA + sndPlaySoundW = _sndPlaySoundW + WOWAppExit = _WOWAppExit + mmsystemGetVersion = _mmsystemGetVersion + + TPValues = TPValues \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..94957f1 --- /dev/null +++ b/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file