1
0
mirror of synced 2024-11-24 06:50:11 +01:00
FFBArcadePlugin/Game Files/AfterburnerClimax.cpp

59 lines
1.8 KiB
C++
Raw Normal View History

2019-09-14 03:13:05 +02:00
/*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/>.
*/
2019-04-07 07:16:19 +02:00
#include <string>
#include "AfterburnerClimax.h"
2021-05-23 01:42:40 +02:00
static bool Version;
static bool NewVersion;
static bool OldVersion;
UINT8 Vibration;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int RumbleStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrength"), 0, settingsFilename);
2021-02-17 08:54:00 +01:00
2019-11-01 21:34:57 +01:00
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
2021-05-23 01:42:40 +02:00
if (!Version)
2020-05-23 00:35:07 +02:00
{
2021-05-23 01:42:40 +02:00
DWORD VersionOrig = helpers->ReadInt32(0x8347A5A, false);
DWORD VersionNew = helpers->ReadInt32(0x834A51A, false);
if (VersionOrig == 0x1320221)
{
OldVersion = true;
Version = true;
}
if (VersionNew == 0x1320221)
{
NewVersion = true;
Version = true;
}
2020-05-23 00:35:07 +02:00
}
2021-05-23 01:42:40 +02:00
if (NewVersion)
Vibration = helpers->ReadByte(0x834A51E, false);
if (OldVersion)
Vibration = helpers->ReadByte(0x8347A5E, false);
2020-05-23 00:35:07 +02:00
2021-05-23 01:42:40 +02:00
helpers->log("got value: ");
std::string ffs = std::to_string(Vibration);
helpers->log((char *)ffs.c_str());
if (Vibration & 0x40)
2020-05-23 00:35:07 +02:00
{
2021-05-23 01:42:40 +02:00
double percentForce = RumbleStrength / 100.0;
double percentLength = 100.0;
2020-05-23 00:35:07 +02:00
triggers->Rumble(percentForce, percentForce, percentLength);
}
2019-04-07 07:16:19 +02:00
}