From 62f48425174cc91f90f9d7f7e4c2130ea49916a7 Mon Sep 17 00:00:00 2001 From: Rocco Date: Sat, 27 Jul 2024 16:52:31 +0800 Subject: [PATCH 1/4] Add wmmt6rr support --- Config/FFBPlugin.ini | 17 ++ Dinput8Wrapper.vcxproj | 2 + Dinput8Wrapper.vcxproj.filters | 4 + DllMain.cpp | 5 + Game Files/WMMT6RR.cpp | 333 +++++++++++++++++++++++++++++++++ Game Files/WMMT6RR.h | 20 ++ README.md | 13 +- 7 files changed, 392 insertions(+), 2 deletions(-) create mode 100644 Game Files/WMMT6RR.cpp create mode 100644 Game Files/WMMT6RR.h diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index 48cfde0..60c62c6 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -954,6 +954,23 @@ LimitBetweenHighSpeedVibrationsAndTiresSlip=75 EnableDamper=0 DamperStrength=100 +[WMMT6RR] +GameId=84 +DefaultCentering=0 +FeedbackLength=80 +Logging=0 +SpringStrength=100 +FrictionStrength=0 +JointsAndStripesStrength=100 +CollisionsStrength=100 +TiresSlipStrength=100 +HighSpeedVibrationsStrength=100 +LimitBetweenHighSpeedVibrationsAndTiresSlip=75 +ReverseTiresSlip=0 +ReverseCollision=0 +EnableDamper=0 +DamperStrength=100 + [Sonic & Sega All Stars Racing] GameId=21 FeedbackLength=80 diff --git a/Dinput8Wrapper.vcxproj b/Dinput8Wrapper.vcxproj index b2fd9a1..b3dd4a9 100644 --- a/Dinput8Wrapper.vcxproj +++ b/Dinput8Wrapper.vcxproj @@ -82,6 +82,7 @@ + Document @@ -177,6 +178,7 @@ + diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 00f1681..e950713 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -168,6 +168,7 @@ + @@ -339,6 +340,9 @@ Common Header Files + + Common Header Files + Common Header Files diff --git a/DllMain.cpp b/DllMain.cpp index c78cfb4..7794da9 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -88,6 +88,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/WMMT5DX+.h" #include "Game Files/WMMT6.h" #include "Game Files/WMMT6R.h" +#include "Game Files/WMMT6RR.h" #include "Game Files/Machstorm.h" #include "Game Files/AfterburnerClimax.h" #include "Game Files/PokkenTournament.h" @@ -1084,6 +1085,7 @@ const int SEGA_RACE_TV = 80; const int HUMMER_EXTREME = 81; const int INITIAL_D_THEARCADE_V231 = 82; const int WASTELAND_RACERS_2071 = 83; +const int WMMT_6_RR = 84; HINSTANCE Get_hInstance() { @@ -2567,6 +2569,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case WMMT_6_R: game = new WMMT6R; break; + case WMMT_6_RR: + game = new WMMT6RR; + break; case SRG: game = new StormRacerG; break; diff --git a/Game Files/WMMT6RR.cpp b/Game Files/WMMT6RR.cpp new file mode 100644 index 0000000..596a66b --- /dev/null +++ b/Game Files/WMMT6RR.cpp @@ -0,0 +1,333 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#include +#include "WMMT6RR.h" +#include "SDL.h" + +extern int EnableDamper; +extern int DamperStrength; +static EffectTriggers* myTriggers; +static EffectConstants* myConstants; +static Helpers* myHelpers; +extern SDL_Event e; +static UINT8 oldgear = 0; +static bool init = false; +static bool gameFfbStarted = false; +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename); +static int FrictionStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FrictionStrength"), 0, settingsFilename); +static int JointsAndStripesStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("JointsAndStripesStrength"), 100, settingsFilename); +static int CollisionsStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("CollisionsStrength"), 100, settingsFilename); +static int TiresSlipStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("TiresSlipStrength"), 100, settingsFilename); +static int HighSpeedVibrationsStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("HighSpeedVibrationsStrength"), 100, settingsFilename); +static int LimitBetweenHighSpeedVibrationsAndTiresSlip = GetPrivateProfileInt(TEXT("Settings"), TEXT("LimitBetweenHighSpeedVibrationsAndTiresSlip"), 75, settingsFilename); + +static int ReverseCollision = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseCollision"), 0, settingsFilename); +static int ReverseTiresSlip = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseTiresSlip"), 0, settingsFilename); +// static int GearChangeStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeStrength"), 20, settingsFilename); +// static int GearChangeDelay = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeDelay"), 250, settingsFilename); +// static int GearChangeLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeLength"), 200, settingsFilename); +// static int WheelSpinStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("WheelSpinStrength"), 100, settingsFilename); +static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename); +//static int ForceFullTune = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceFullTune"), 0, settingsFilename); +//static int DisableRaceTimer = GetPrivateProfileInt(TEXT("Settings"), TEXT("DisableRaceTimer"), 0, settingsFilename); +//static int EnableForceFinish = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceFinish"), 0, settingsFilename); +//static int EnableForceTimeUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceTimeUp"), 0, settingsFilename); +//static int ForceFinishButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceFinishButton"), 99, settingsFilename); +//static int ForceTimeUpButton = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceTimeUpButton"), 99, settingsFilename); + +//static int InputThread(void* ptr) +//{ +// if (1 != EnableForceFinish && 1 != EnableForceTimeUp) +// { +// return 0; +// } +// +// myHelpers->log("starting input thread"); +// while (SDL_WaitEvent(&e) != 0) +// { +// if (e.type == SDL_JOYBUTTONDOWN) +// { +// myHelpers->log("button pressed"); +// if (1 == EnableForceFinish && e.jbutton.button == ForceFinishButton) +// { +// INT_PTR ptr1 = myHelpers->ReadIntPtr(0x199A468, true); +// myHelpers->WriteByte(ptr1 + 0x28, 8, false); +// } +// else if (1 == EnableForceTimeUp && e.jbutton.button == ForceTimeUpButton) +// { +// int tempDisableRaceTimer = DisableRaceTimer; +// DisableRaceTimer = 0; +// myHelpers->WriteFloat32(0x199AE18, 0, true); +// if (1 == tempDisableRaceTimer) +// { +// Sleep(10000); +// DisableRaceTimer = tempDisableRaceTimer; +// } +// } +// } +// } +// myHelpers->log("input thread stopped"); +// return 0; +//} +// +//static int SpamThread(void* ptr) +//{ +// if (1 != ForceFullTune && 1 != DisableRaceTimer) +// { +// return 0; +// } +// +// Sleep(5000); // To avoid crashes +// myHelpers->log("starting spam thread"); +// while (1) +// { +// if (1 == ForceFullTune) +// { +// INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1948F10, true); +// INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x180 + 0xa8 + 0x18, false); +// UINT8 car = myHelpers->ReadByte(ptr2 + 0x2C, false); +// std::string msg = "car: " + std::to_string(car); +// myHelpers->log((char*)msg.c_str()); +// +// if (0x00 < car) +// { +// UINT8 power = myHelpers->ReadByte(ptr2 + 0x98, false); +// UINT8 handling = myHelpers->ReadByte(ptr2 + 0x9C, false); +// msg = "power: " + std::to_string(power) + " | handling: " + std::to_string(handling); +// myHelpers->log((char*)msg.c_str()); +// +// if (0x20 != (power + handling)) +// { +// myHelpers->log("forcing full tune"); +// myHelpers->WriteByte(ptr2 + 0x98, 0x10, false); +// myHelpers->WriteByte(ptr2 + 0x9C, 0x10, false); +// } +// } +// } +// +// if (1 == DisableRaceTimer) +// { +// myHelpers->WriteFloat32(0x199AE18, 999.99, true); +// } +// +// Sleep(500); // We don't need to spam too much +// } +// myHelpers->log("spam thread stopped"); +// return 0; +//} + +// static int GearChangeThread(void* ptr) +// { +// if (GearChangeDelay > 0) +// { +// Sleep(GearChangeDelay); +// } +// myHelpers->log("gear change"); +// double percentForce = GearChangeStrength / 100.0; +// myTriggers->Sine(GearChangeLength, GearChangeLength, percentForce); +// myTriggers->Rumble(0, percentForce, 150); +// return 0; +// } + +void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) +{ + if (!init) + { + init = true; + myTriggers = triggers; + myConstants = constants; + myHelpers = helpers; + //SDL_CreateThread(InputThread, "InputThread", (void*)NULL); + //SDL_CreateThread(SpamThread, "SpamThread", (void*)NULL); + } + + float spring = helpers->ReadFloat32(0x1F25264, true); + float friction = helpers->ReadFloat32(0x1F25268, true); + float collisions = helpers->ReadFloat32(0x1F2526C, true); + float tiresSlip = helpers->ReadFloat32(0x1F25260, true); + int speed = helpers->ReadInt32(0x1F2612C, true); + std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction) + + " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip) + + " | speed: " + std::to_string(speed); + helpers->log((char*)msg.c_str()); + if(ReverseCollision) + { + collisions = -collisions; + } + if(ReverseTiresSlip) + { + tiresSlip = -tiresSlip; + } + + if (EnableDamper == 1) + { + triggers->Damper(DamperStrength / 100.0); + } + + double percentForce; + if (0.001 > spring && !gameFfbStarted) + { + helpers->log("fake spring+friction until game's FFB starts"); + percentForce = 0.3 * SpringStrength / 100.0; + triggers->Spring(percentForce); + percentForce = 0.5 * FrictionStrength / 100.0; + triggers->Friction(percentForce); + } + else + { + if (!gameFfbStarted) + { + helpers->log("game's FFB started"); + gameFfbStarted = true; + } + percentForce = (1.0 * spring) * SpringStrength / 100.0; + triggers->Spring(percentForce); + percentForce = (1.0 * friction) * FrictionStrength / 100.0; + triggers->Friction(percentForce); + } + + if (0 < collisions) + { + if (0.209 <= collisions && 0.311 >= collisions) + { + helpers->log("joint/stripe on the right"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, percentForce, 150); + } + else + { + helpers->log("collision on the right"); + percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + triggers->Rumble(0, percentForce, 150); + } + } + else if (0 > collisions) + { + if (-0.209 >= collisions && -0.311 <= collisions) + { + helpers->log("joint/stripe on the left"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, -1.0 * percentForce, 150); + } + else + { + helpers->log("collision on the left"); + percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + triggers->Rumble(0, percentForce, 150); + } + } + else + { + helpers->log("resetting collision"); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); + } + + if (0 < tiresSlip) + { + helpers->log("tires slip left"); + bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, -1.0 * percentForce, 150); + } + } + else if (0 > tiresSlip) + { + helpers->log("tires slip right"); + bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, percentForce, 150); + } + } +/* TODO + INT_PTR ptr1 = helpers->ReadIntPtr(0x20681C0, true); //Wg6Enma_Release_IDL0.dll+29B3E0 + UINT8 gear = helpers->ReadByte(ptr1 + 0x3AC, false); //ptr1 + 0x3A8 + + if (0 < WheelSpinStrength) + { + //INT_PTR ptr1 = myHelpers->ReadIntPtr(0x1948F10, true); + //INT_PTR ptr2 = myHelpers->ReadIntPtr(ptr1 + 0x180 + 0xa8 + 0x18, false); + //UINT8 power = myHelpers->ReadByte(ptr2 + 0x98, false); + UINT8 power = 16; + int rpm = helpers->ReadInt32(0x1F2629C, true); //wmn6r.exe+1F2629C + int diff = 0x0A <= power ? 0 : 20; + + if ( + 1 == gear && 10 < speed && ( + ((30 - diff) > speed && 3500 < rpm) + || ((55 - diff) > speed && 5500 < rpm) + || ((75 - diff) > speed && 7000 < rpm) + || ((100 - diff) > speed && 7800 < rpm) + ) + ) + { + percentForce = (((100.0 - speed) / 100.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0; + triggers->Sine(120, 120, percentForce); + triggers->Rumble(0, percentForce, 150); + + msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed) + + " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce); + helpers->log((char*)msg.c_str()); + } + else if ( + 2 == gear && 10 < speed && ( + ((110 - (2 * diff)) > speed && 5000 < rpm) + || ((130 - (2 * diff)) > speed && 6000 < rpm) + || ((145 - (2 * diff)) > speed && 6500 < rpm) + || ((160 - (2 * diff)) > speed && 7000 < rpm) + ) + ) + { + percentForce = (((160.0 - speed) / 150.0) * ((rpm * 100.0 / 8500.0) / 100.0)) * WheelSpinStrength / 100.0; + triggers->Sine(120, 120, percentForce); + triggers->Rumble(0, percentForce, 150); + + msg = "tires spin: gear: " + std::to_string(gear) + " | speed: " + std::to_string(speed) + + " | rpm: " + std::to_string(rpm) + " | force: " + std::to_string(percentForce); + helpers->log((char*)msg.c_str()); + } + } + + if (0 < GearChangeStrength) + { + INT_PTR ptrtime = helpers->ReadIntPtr(0x20681D8, true); //Wg6Enma_Release_IDL0.dll+29B3F8 + float time = helpers->ReadFloat32(ptrtime + 0x18, false); //ptrtime + 0x18 + + if (oldgear != gear && 0 < gear && 0 < time) + { + msg = "oldgear: " + std::to_string(oldgear) + " | gear: " + std::to_string(gear) + + " | time: " + std::to_string(time) + " | speed: " + std::to_string(speed); + helpers->log((char*)msg.c_str()); + } + + if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed) + { + SDL_CreateThread(GearChangeThread, "GearChangeThread", (void*)NULL); + } + oldgear = gear; + } +*/ +} \ No newline at end of file diff --git a/Game Files/WMMT6RR.h b/Game Files/WMMT6RR.h new file mode 100644 index 0000000..e2e54be --- /dev/null +++ b/Game Files/WMMT6RR.h @@ -0,0 +1,20 @@ +/*This file is part of FFB Arcade Plugin. +FFB Arcade Plugin is free software : you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +FFB Arcade Plugin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. +*/ + +#pragma once +#include "../Common Files/Game.h" +class WMMT6RR : public Game { + +public: + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file diff --git a/README.md b/README.md index 8d64f64..fd80b9d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ -# FFB Arcade Plugin +# FFB Arcade Plugin - WMMT6RR Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb & pinkimo. -This is a plugin to provide Force Feedback and Rumble to various arcade games. +6RR version brought to you by Rocco. +This is a plugin to provide Force Feedback and Rumble to various arcade games, including WMMT6RR. + +## Changelog in 6RR ver: + +- Temporarily removed Additional Fake Effects from 6R due to DLL memory access issue +- Add Reverse Collision option +- Add Reverse Tires Slip option +- Have fun ;) ## Requirements @@ -238,3 +246,4 @@ extremely generous. - Wangan Midnight Maximum Tune 5DX+ - Wangan Midnight Maximum Tune 6 - Wangan Midnight Maximum Tune 6R +- Wangan Midnight Maximum Tune 6RR \ No newline at end of file From dcbce3427832aca740d05c4c9f063a95d829c895 Mon Sep 17 00:00:00 2001 From: Rocco Date: Wed, 31 Jul 2024 18:08:51 +0800 Subject: [PATCH 2/4] Fix wheel shaking after drifting through finish line for wmmt6rr --- Game Files/WMMT6RR.cpp | 124 ++++++++++++++++++++--------------------- README.md | 14 ++--- 2 files changed, 65 insertions(+), 73 deletions(-) diff --git a/Game Files/WMMT6RR.cpp b/Game Files/WMMT6RR.cpp index 596a66b..1181af9 100644 --- a/Game Files/WMMT6RR.cpp +++ b/Game Files/WMMT6RR.cpp @@ -23,7 +23,7 @@ static Helpers* myHelpers; extern SDL_Event e; static UINT8 oldgear = 0; static bool init = false; -static bool gameFfbStarted = false; +// static bool gameFfbStarted = false; static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 100, settingsFilename); static int FrictionStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FrictionStrength"), 0, settingsFilename); @@ -158,9 +158,10 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge float collisions = helpers->ReadFloat32(0x1F2526C, true); float tiresSlip = helpers->ReadFloat32(0x1F25260, true); int speed = helpers->ReadInt32(0x1F2612C, true); + int rpm = helpers->ReadInt32(0x1F2629C, true); std::string msg = "spring: " + std::to_string(spring) + " | friction: " + std::to_string(friction) + " | collisions: " + std::to_string(collisions) + " | tires slip: " + std::to_string(tiresSlip) - + " | speed: " + std::to_string(speed); + + " | speed: " + std::to_string(speed)+ " | rpm: " +std::to_string(rpm); helpers->log((char*)msg.c_str()); if(ReverseCollision) { @@ -177,7 +178,7 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge } double percentForce; - if (0.001 > spring && !gameFfbStarted) + if (!rpm && !speed) { helpers->log("fake spring+friction until game's FFB starts"); percentForce = 0.3 * SpringStrength / 100.0; @@ -187,81 +188,78 @@ void WMMT6RR::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge } else { - if (!gameFfbStarted) - { - helpers->log("game's FFB started"); - gameFfbStarted = true; - } + helpers->log("game's FFB started"); percentForce = (1.0 * spring) * SpringStrength / 100.0; triggers->Spring(percentForce); percentForce = (1.0 * friction) * FrictionStrength / 100.0; triggers->Friction(percentForce); - } - - if (0 < collisions) - { - if (0.209 <= collisions && 0.311 >= collisions) + if (0 < collisions) { - helpers->log("joint/stripe on the right"); - percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; - triggers->Sine(80, 80, percentForce); - triggers->Rumble(0, percentForce, 150); + if (0.209 <= collisions && 0.311 >= collisions) + { + helpers->log("joint/stripe on the right"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, percentForce, 150); + } + else + { + helpers->log("collision on the right"); + percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); + triggers->Rumble(0, percentForce, 150); + } + } + else if (0 > collisions) + { + if (-0.209 >= collisions && -0.311 <= collisions) + { + helpers->log("joint/stripe on the left"); + percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; + triggers->Sine(80, 80, percentForce); + triggers->Rumble(0, -1.0 * percentForce, 150); + } + else + { + helpers->log("collision on the left"); + percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; + triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); + triggers->Rumble(0, percentForce, 150); + } } else { - helpers->log("collision on the right"); - percentForce = (1.0 * collisions) * CollisionsStrength / 100.0; - triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); - triggers->Rumble(0, percentForce, 150); + helpers->log("resetting collision"); + triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); } - } - else if (0 > collisions) - { - if (-0.209 >= collisions && -0.311 <= collisions) + + if (0 < tiresSlip) { - helpers->log("joint/stripe on the left"); - percentForce = (1.0 * collisions) * JointsAndStripesStrength / 100.0; - triggers->Sine(80, 80, percentForce); - triggers->Rumble(0, -1.0 * percentForce, 150); + helpers->log("tires slip left"); + bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, -1.0 * percentForce, 150); + } } - else + else if (0 > tiresSlip) { - helpers->log("collision on the left"); - percentForce = (-1.0 * collisions) * CollisionsStrength / 100.0; - triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); - triggers->Rumble(0, percentForce, 150); + helpers->log("tires slip right"); + bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); + percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; + triggers->Sine(100, 100, percentForce); + + if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) + { + triggers->Rumble(0, percentForce, 150); + } } } - else - { - helpers->log("resetting collision"); - triggers->Constant(constants->DIRECTION_FROM_LEFT, 0); - } - if (0 < tiresSlip) - { - helpers->log("tires slip left"); - bool highSpeedVibrations = (294 <= speed) && (1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); - percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; - triggers->Sine(100, 100, percentForce); - - if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) - { - triggers->Rumble(0, -1.0 * percentForce, 150); - } - } - else if (0 > tiresSlip) - { - helpers->log("tires slip right"); - bool highSpeedVibrations = (294 <= speed) && (-1.0 * tiresSlip) < (LimitBetweenHighSpeedVibrationsAndTiresSlip / 1000.0); - percentForce = (-1.0 * tiresSlip) * (highSpeedVibrations ? HighSpeedVibrationsStrength : TiresSlipStrength) / 100.0; - triggers->Sine(100, 100, percentForce); - - if (!highSpeedVibrations && ((0 == JointsAndStripesStrength && 0 == CollisionsStrength) || (0.001 > collisions && -0.001 < collisions))) - { - triggers->Rumble(0, percentForce, 150); - } - } + /* TODO INT_PTR ptr1 = helpers->ReadIntPtr(0x20681C0, true); //Wg6Enma_Release_IDL0.dll+29B3E0 UINT8 gear = helpers->ReadByte(ptr1 + 0x3AC, false); //ptr1 + 0x3A8 diff --git a/README.md b/README.md index fd80b9d..2808802 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,9 @@ -# FFB Arcade Plugin - WMMT6RR +# FFB Arcade Plugin Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb & pinkimo. -6RR version brought to you by Rocco. +This is a plugin to provide Force Feedback and Rumble to various arcade games. -This is a plugin to provide Force Feedback and Rumble to various arcade games, including WMMT6RR. - -## Changelog in 6RR ver: - -- Temporarily removed Additional Fake Effects from 6R due to DLL memory access issue -- Add Reverse Collision option -- Add Reverse Tires Slip option -- Have fun ;) ## Requirements @@ -91,6 +83,8 @@ extremely generous. - headkaze for making MAMEInterOp SDK +- Rocco for WMMT6RR FFB. + - Everyone who helps and gives back to this awesome scene. Thanks for everything! From edcd8407bb10754f6e30fc09a86fbab89c20efc8 Mon Sep 17 00:00:00 2001 From: Boomslangnz Date: Thu, 1 Aug 2024 11:05:56 +1200 Subject: [PATCH 3/4] New Version --- AutoSetup.cmd | 5 +++++ DInput8Wrapper.aps | Bin 2740 -> 2740 bytes DInput8Wrapper.rc | Bin 5212 -> 5212 bytes Includes/FFBPluginReadme.txt | 4 +++- README.md | 2 +- Version.txt | 2 +- 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/AutoSetup.cmd b/AutoSetup.cmd index 6d994c9..adf2dce 100644 --- a/AutoSetup.cmd +++ b/AutoSetup.cmd @@ -32,6 +32,8 @@ xcopy ".\Release.x64\dinput8.dll" ".\Release.Win32\WMMT6" /Y xcopy ".\Release.x64\SDL2.dll" ".\Release.Win32\WMMT6" /Y xcopy ".\Release.x64\dinput8.dll" ".\Release.Win32\WMMT6R" /Y xcopy ".\Release.x64\SDL2.dll" ".\Release.Win32\WMMT6R" /Y +xcopy ".\Release.x64\dinput8.dll" ".\Release.Win32\WMMT6RR" /Y +xcopy ".\Release.x64\SDL2.dll" ".\Release.Win32\WMMT6RR" /Y xcopy ".\MAME32.dll" ".\Release.Win32\MAME 32bit Outputs" /Y xcopy ".\MAME64.dll" ".\Release.Win32\MAME 64bit Outputs" /Y xcopy ".\MAME32.dll" ".\Release.Win32\Supermodel 32bit Outputs" /Y @@ -173,6 +175,9 @@ cd.. cd WMMT6R rename dinput8.dll d3d11.dll cd.. +cd WMMT6RR +rename dinput8.dll d3d11.dll +cd.. del dinput8.exp del dinput8.lib del SDL2.dll diff --git a/DInput8Wrapper.aps b/DInput8Wrapper.aps index 17df7d58bdcd31643e55defb903957cb50b429f3..47f72a109d9a3cde785e7bb52319ed02b7065637 100644 GIT binary patch delta 36 ncmdlYx&8@0|+oNm~KvGQ)FZ`-rUZv4Wc%4FfsuEl^6%0 delta 36 ncmdlYx&8j0|+oNm~2jEQ)FZ`+T6~r4Wc%4FfsuEl+_2E diff --git a/DInput8Wrapper.rc b/DInput8Wrapper.rc index 7a5c48c176380ee9838606f4ee0edc447b6cf28e..78752543e2449a6ddf23de5df09aaa0976d32e26 100644 GIT binary patch delta 38 rcmcbkaYtiA7&oKw&0@^G9@Tv&0@^G9@LdZr diff --git a/Includes/FFBPluginReadme.txt b/Includes/FFBPluginReadme.txt index 811f094..23fd60f 100644 --- a/Includes/FFBPluginReadme.txt +++ b/Includes/FFBPluginReadme.txt @@ -1,6 +1,6 @@ ***FFB Arcade Plugin*** -Brought to you by Boomslangnz, MightyMike, Ducon2016, Spazzy, Adam_, jpb & pinkimo. +Brought to you by Boomslangnz, MightyMike, Ducon2016, Spazzy, Adam_, jpb, Rocco & pinkimo. This is a plugin to provide Force Feedback and Rumble to various arcade games. @@ -80,6 +80,8 @@ extremely generous. - headkaze for making MAMEInterOp SDK +- Rocco for WMMT6RR FFB. + - Everyone who helps and gives back to this awesome scene. Thanks for everything! diff --git a/README.md b/README.md index 2808802..86675be 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FFB Arcade Plugin -Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb & pinkimo. +Brought to you by Boomslangnz, Ducon2016, Spazzy, Adam_, jpb, Rocco & pinkimo. This is a plugin to provide Force Feedback and Rumble to various arcade games. diff --git a/Version.txt b/Version.txt index 538661b..93d6728 100644 --- a/Version.txt +++ b/Version.txt @@ -1 +1 @@ -v2.0.0.52 \ No newline at end of file +v2.0.0.53 \ No newline at end of file From f4db76fe7bc607573d2d3249bf2cbe3e28be002d Mon Sep 17 00:00:00 2001 From: Boomslangnz Date: Thu, 1 Aug 2024 11:09:19 +1200 Subject: [PATCH 4/4] AutoSetup --- AutoSetup.cmd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AutoSetup.cmd b/AutoSetup.cmd index adf2dce..d36bf22 100644 --- a/AutoSetup.cmd +++ b/AutoSetup.cmd @@ -136,6 +136,9 @@ cd.. cd R-Tuned rename dinput8.dll opengl32.dll cd.. +cd "Sega Race TV" +rename dinput8.dll opengl32.dll +cd.. cd "Sega World Drivers Championship 2018" rename dinput8.dll d3d11.dll cd..