1
0
mirror of synced 2024-12-18 01:05:58 +01:00

Modified so Pokken uses vibration value from TP

This commit is contained in:
Aaron M 2020-04-09 19:18:52 +12:00
parent bbdfacb64d
commit 49316aa9ee
5 changed files with 52 additions and 49 deletions

View File

@ -1,17 +1,43 @@
#include "TeknoParrotGame.h" #include "TeknoParrotGame.h"
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 0, settingsFilename);
TeknoParrotGame::TeknoParrotGame() TeknoParrotGame::TeknoParrotGame()
{ {
hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState"); hSection = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, 64, L"TeknoParrot_JvsState");
secData = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 64); 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() int TeknoParrotGame::GetTeknoParrotFFB()
{ {
ffbOffset = *((int *)secData + 2); if (configGameId == 19)
{
ffbOffset = *((int*)secData + 6);
}
else
{
ffbOffset = *((int*)secData + 2);
}
return ffbOffset; return ffbOffset;
} }
int TeknoParrotGame::GetTeknoParrotFFB2()
{
ffbOffset2 = *((int*)secData + 7);
return ffbOffset2;
}
void TeknoParrotGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) { void TeknoParrotGame::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
helpers->log("TeknoParrot game not implemented"); helpers->log("TeknoParrot game not implemented");
} }

View File

@ -7,9 +7,11 @@ class TeknoParrotGame : public Game {
HANDLE hSection; HANDLE hSection;
LPVOID secData; LPVOID secData;
int ffbOffset = 0; int ffbOffset = 0;
int ffbOffset2 = 0;
protected: protected:
int GetTeknoParrotFFB(); int GetTeknoParrotFFB();
int GetTeknoParrotFFB2();
TeknoParrotGame(); TeknoParrotGame();
public: public:

View File

@ -249,9 +249,7 @@ Power10RumbleLength=100
[PokkenTournament] [PokkenTournament]
GameId=19 GameId=19
RumbleStrength=100 FeedbackLength=80
RumbleLength=500
HowtoRumble=0
[Mario Kart Arcade GP DX v100] [Mario Kart Arcade GP DX v100]
GameId=11 GameId=11

View File

@ -14,50 +14,26 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include <string> #include <string>
#include "PokkenTournament.h" #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); void PokkenTournament::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
INT_PTR ff1 = helpers->ReadIntPtr(ffAddress + 0x60, /* isRelativeOffset */ false); {
INT_PTR ff2 = helpers->ReadIntPtr(ff1 + 0x8, /* isRelativeOffset */ false); helpers->log("in PokkenTournament Ffbloop");
float ff3 = helpers->ReadFloat32(ff2 + 0xCC, /* isRelativeOffset */ false); //health const int LeftMotor = GetTeknoParrotFFB();
INT_PTR ffAddress4 = helpers->ReadIntPtr(0x00EC4C20, /* isRelativeOffset*/ true); const int RightMotor = GetTeknoParrotFFB2();
INT_PTR ff5 = helpers->ReadIntPtr(ffAddress4 + 0x60, /* isRelativeOffset */ false); std::string ffs = std::to_string(LeftMotor);
INT_PTR ff6 = helpers->ReadIntPtr(ff5 + 0x120, /* isRelativeOffset */ false); helpers->log((char*)ffs.c_str());
INT_PTR ff7 = helpers->ReadIntPtr(ff6 + 0x698, /* isRelativeOffset */ false); //1 during battle except for first startup
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini"); if (LeftMotor > 3)
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 percentForce = (LeftMotor / 255.0);
double percentLength = (RumbleLength); triggers->Rumble(0, percentForce, configFeedbackLength);
triggers->Rumble(percentForce, percentForce, percentLength);
} }
else if (HowtoRumble == 1)
if (RightMotor > 3)
{ {
double percentForce = ((RumbleStrength) / 100.0); double percentForce = (RightMotor / 255.0);
double percentLength = (RumbleLength); triggers->Rumble(percentForce, 0, configFeedbackLength);
triggers->Rumble(0, percentForce, percentLength);
} }
else if (HowtoRumble == 2)
{
double percentForce = ((RumbleStrength) / 100.0);
double percentLength = (RumbleLength);
triggers->Rumble(percentForce, 0, percentLength);
}
}
oldFloat = newFloat;
} }

View File

@ -12,9 +12,10 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include "../Common Files/Game.h" #include "../Common Files/TeknoParrotGame.h"
class PokkenTournament : public Game {
class PokkenTournament : public TeknoParrotGame {
public: public:
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); PokkenTournament() : TeknoParrotGame() { }
}; void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};