1
0
mirror of synced 2024-11-23 22:40:57 +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"
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");
}

View File

@ -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:

View File

@ -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

View File

@ -14,50 +14,26 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include <string>
#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;
}

View File

@ -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);
};