diff --git a/Common Files/TeknoParrotGame.cpp b/Common Files/TeknoParrotGame.cpp index b7a2983..365ae09 100644 --- a/Common Files/TeknoParrotGame.cpp +++ b/Common Files/TeknoParrotGame.cpp @@ -1,17 +1,43 @@ #include "TeknoParrotGame.h" +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 0, settingsFilename); + 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); + + if (configGameId == 19) + { + ffbOffset = *((int*)secData + 6); + ffbOffset2 = *((int*)secData + 7); + } + else + { + ffbOffset = *((int*)secData + 2); + } } int TeknoParrotGame::GetTeknoParrotFFB() { - ffbOffset = *((int *)secData + 2); + if (configGameId == 19) + { + ffbOffset = *((int*)secData + 6); + } + else + { + ffbOffset = *((int*)secData + 2); + } + return ffbOffset; } +int TeknoParrotGame::GetTeknoParrotFFB2() +{ + ffbOffset2 = *((int*)secData + 7); + return ffbOffset2; +} + 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 index 4869128..d729f4e 100644 --- a/Common Files/TeknoParrotGame.h +++ b/Common Files/TeknoParrotGame.h @@ -7,9 +7,11 @@ class TeknoParrotGame : public Game { HANDLE hSection; LPVOID secData; int ffbOffset = 0; + int ffbOffset2 = 0; protected: int GetTeknoParrotFFB(); + int GetTeknoParrotFFB2(); TeknoParrotGame(); public: diff --git a/Config/FFBPlugin.ini b/Config/FFBPlugin.ini index d547ac9..cfe392a 100644 --- a/Config/FFBPlugin.ini +++ b/Config/FFBPlugin.ini @@ -249,9 +249,7 @@ Power10RumbleLength=100 [PokkenTournament] GameId=19 -RumbleStrength=100 -RumbleLength=500 -HowtoRumble=0 +FeedbackLength=80 [Mario Kart Arcade GP DX v100] GameId=11 diff --git a/Game Files/PokkenTournament.cpp b/Game Files/PokkenTournament.cpp index fa34967..1ce87b5 100644 --- a/Game Files/PokkenTournament.cpp +++ b/Game Files/PokkenTournament.cpp @@ -14,50 +14,26 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include #include "PokkenTournament.h" -void PokkenTournament::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { +static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); +static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename); - 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 +void PokkenTournament::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) +{ + helpers->log("in PokkenTournament Ffbloop"); + const int LeftMotor = GetTeknoParrotFFB(); + const int RightMotor = GetTeknoParrotFFB2(); + std::string ffs = std::to_string(LeftMotor); + helpers->log((char*)ffs.c_str()); - 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) + if (LeftMotor > 3) { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - triggers->Rumble(percentForce, percentForce, percentLength); + double percentForce = (LeftMotor / 255.0); + triggers->Rumble(0, percentForce, configFeedbackLength); } - else if (HowtoRumble == 1) + + if (RightMotor > 3) { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - triggers->Rumble(0, percentForce, percentLength); + double percentForce = (RightMotor / 255.0); + triggers->Rumble(percentForce, 0, configFeedbackLength); } - else if (HowtoRumble == 2) - { - double percentForce = ((RumbleStrength) / 100.0); - double percentLength = (RumbleLength); - triggers->Rumble(percentForce, 0, percentLength); - } - } - oldFloat = newFloat; } \ No newline at end of file diff --git a/Game Files/PokkenTournament.h b/Game Files/PokkenTournament.h index 0b5a2d5..ab5df20 100644 --- a/Game Files/PokkenTournament.h +++ b/Game Files/PokkenTournament.h @@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. */ #pragma once -#include "../Common Files/Game.h" -class PokkenTournament : public Game { +#include "../Common Files/TeknoParrotGame.h" +class PokkenTournament : public TeknoParrotGame { public: - void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); -}; + PokkenTournament() : TeknoParrotGame() { } + void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers); +}; \ No newline at end of file