Bunch of code changes, added transformers and rambo etc
This commit is contained in:
parent
22dfc0148d
commit
46b990e5e5
@ -246,6 +246,19 @@ GameId=13
|
||||
DefaultCentering=25
|
||||
FeedbackLength=500
|
||||
|
||||
[Transformers]
|
||||
GameId=40
|
||||
FeedbackLength=100
|
||||
Device2GUID=
|
||||
EnableRumbleDevice2=1
|
||||
ReverseRumbleDevice=0
|
||||
Gun1pStrength=50
|
||||
Health1pStrength=100
|
||||
Gun2pStrength=50
|
||||
Health2pStrength=100
|
||||
HowtoRumbleGunEffect=2
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[Aliens Extermination]
|
||||
GameId=36
|
||||
EscapeKeyExitViaPlugin=1
|
||||
@ -259,8 +272,24 @@ Health1pStrength=100
|
||||
Gun2pStrength=50
|
||||
Flame2pStrength=60
|
||||
Health2pStrength=100
|
||||
HowtoRumbleGunEffect=0
|
||||
HowtoRumbleFlameEffect=0
|
||||
HowtoRumbleGunEffect=2
|
||||
HowtoRumbleFlameEffect=1
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[Rambo]
|
||||
GameId=37
|
||||
FeedbackLength=100
|
||||
Device2GUID=
|
||||
EnableRumbleDevice2=1
|
||||
ReverseRumbleDevice=0
|
||||
Gun1pStrength=50
|
||||
Rage1pStrength=60
|
||||
Health1pStrength=100
|
||||
Gun2pStrength=50
|
||||
Rage2pStrength=60
|
||||
Health2pStrength=100
|
||||
HowtoRumbleGunEffect=2
|
||||
HowtoRumbleRageEffect=1
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[MAME 32bit Outputs]
|
||||
|
@ -36,6 +36,7 @@
|
||||
<ClInclude Include="Game Files\InitialD5.h" />
|
||||
<ClInclude Include="Game Files\InitialD4Japan.h" />
|
||||
<ClInclude Include="Game Files\M2Emulator.h" />
|
||||
<ClInclude Include="Game Files\Rambo.h" />
|
||||
<ClInclude Include="Game Files\RoadFighters3D.h" />
|
||||
<ClInclude Include="Game Files\LGI.h" />
|
||||
<ClInclude Include="Game Files\LGI3D.h" />
|
||||
@ -72,12 +73,14 @@
|
||||
<ClCompile Include="Game Files\OldMame.cpp" />
|
||||
<ClCompile Include="Game Files\OutRun2Fake.cpp" />
|
||||
<ClCompile Include="Game Files\PokkenTournament.cpp" />
|
||||
<ClCompile Include="Game Files\Rambo.cpp" />
|
||||
<ClCompile Include="Game Files\SegaRally3.cpp" />
|
||||
<ClCompile Include="Game Files\SegaRacingClassic.cpp" />
|
||||
<ClCompile Include="Game Files\FordRacing.cpp" />
|
||||
<ClCompile Include="Game Files\MarioKartGPDX.cpp" />
|
||||
<ClCompile Include="Game Files\SonicSegaAllStarsRacing.cpp" />
|
||||
<ClCompile Include="Game Files\TestGame.cpp" />
|
||||
<ClCompile Include="Game Files\Transformers.cpp" />
|
||||
<ClCompile Include="Game Files\WackyRaces.cpp" />
|
||||
<ClCompile Include="Game Files\WMMT5.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD4Japan.cpp" />
|
||||
@ -110,6 +113,7 @@
|
||||
<ClInclude Include="Game Files\MarioKartGPDX.h" />
|
||||
<ClInclude Include="Game Files\SonicSegaAllStarsRacing.h" />
|
||||
<ClInclude Include="Game Files\TestGame.h" />
|
||||
<ClInclude Include="Game Files\Transformers.h" />
|
||||
<ClInclude Include="Game Files\WackyRaces.h" />
|
||||
<ClInclude Include="Game Files\WMMT5.h" />
|
||||
<ClInclude Include="Game Files\GTIClub3.h" />
|
||||
|
@ -117,6 +117,8 @@
|
||||
<ClCompile Include="Game Files\OldMame.cpp" />
|
||||
<ClCompile Include="Game Files\OutputReading.cpp" />
|
||||
<ClCompile Include="Game Files\AliensExtermination.cpp" />
|
||||
<ClCompile Include="Game Files\Rambo.cpp" />
|
||||
<ClCompile Include="Game Files\Transformers.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\Daytona3.h">
|
||||
@ -243,6 +245,12 @@
|
||||
<ClInclude Include="Game Files\AliensExtermination.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\Rambo.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\Transformers.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="DLLWrapper.asm" />
|
||||
|
12
DllMain.cpp
12
DllMain.cpp
@ -65,6 +65,8 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "Game Files/LGI.h"
|
||||
#include "Game Files/KODrive.h"
|
||||
#include "Game Files/HOTD4.h"
|
||||
#include "Game Files/Rambo.h"
|
||||
#include "Game Files/Transformers.h"
|
||||
|
||||
// typedefs
|
||||
typedef unsigned char U8;
|
||||
@ -938,8 +940,10 @@ const int OLDMAME_ = 33;
|
||||
const int SUPERMODEL_READING = 34;
|
||||
const int OUTRUN_2Real = 35;
|
||||
const int ALIENS_EXTERMINATION = 36;
|
||||
const int RAMBO_ = 37;
|
||||
const int FORD_RACING_OTHER = 38;
|
||||
const int KO_Drive = 39;
|
||||
const int Transformers_ = 40;
|
||||
|
||||
HINSTANCE Get_hInstance()
|
||||
{
|
||||
@ -1965,6 +1969,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case GRID_:
|
||||
game = new GRID;
|
||||
break;
|
||||
case Transformers_:
|
||||
game = new Transformers;
|
||||
break;
|
||||
case INITIAL_D_0:
|
||||
game = new InitialD0;
|
||||
break;
|
||||
@ -2016,6 +2023,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case POKKEN_TOURNAMENT:
|
||||
game = new PokkenTournament;
|
||||
break;
|
||||
case RAMBO_:
|
||||
game = new Rambo;
|
||||
break;
|
||||
case MARIO_KART_GPDX_110:
|
||||
game = new MarioKartGPDX110;
|
||||
break;
|
||||
@ -2173,7 +2183,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
|
||||
gl_hjgtDll = LoadLibraryA("jgt.dll");
|
||||
gl_hlibavs = LoadLibraryA("libavs-win32-ea3.dll");
|
||||
}
|
||||
if (configGameId == 4)
|
||||
if ((configGameId == 4) || (configGameId == 37))
|
||||
{
|
||||
gl_cgGLDll = LoadLibraryA("cgGL.dll");
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static bool init = false;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
||||
@ -64,50 +65,52 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
TerminateProcess(GetCurrentProcess(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
if (!init)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
continue;
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static UINT8 oldAmmo = 0;
|
||||
UINT8 newAmmo = Ammo1pA;
|
||||
|
||||
|
@ -15,14 +15,12 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "ButtonRumble.h"
|
||||
#include "SDL.h"
|
||||
#include <Windows.h>
|
||||
static bool init = false;
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
@ -53,70 +51,57 @@ static int Button8Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("B
|
||||
static int Button9Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button9Device2Rumble"), 0, settingsFilename);
|
||||
static int Button10Device2Rumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("Button10Device2Rumble"), 0, settingsFilename);
|
||||
|
||||
static int RunningThread(void* ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
if (!init)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
continue;
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
if (ShowButtonNumbersForSetup == 1)
|
||||
{
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
@ -144,7 +129,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,7 +140,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,7 +151,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,7 +165,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,7 +176,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +187,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,7 +202,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->Rumble(0, 0, percentLength);
|
||||
triggers->Rumble(0, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -228,13 +213,10 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
{
|
||||
double percentForce = ((RumbleStrength) / 100.0);
|
||||
double percentLength = (RumbleLength);
|
||||
myTriggers->RumbleDevice2(0, 0, percentLength);
|
||||
triggers->RumbleDevice2(0, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
@ -36,57 +36,66 @@ static int GearUp = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearUp"), 0, se
|
||||
static int GearDown = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearDown"), 0, settingsFilename);
|
||||
static int HideCursor = GetPrivateProfileInt(TEXT("Settings"), TEXT("HideCursor"), 0, settingsFilename);
|
||||
|
||||
static int RunningThread(void *ptr)
|
||||
{
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
static int ThreadLoop()
|
||||
{
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
UINT8 gear = myHelpers->ReadByte(0x019B468C, /* isRelativeOffset */ false);
|
||||
|
||||
if (ShowButtonNumbersForSetup == 1)
|
||||
{
|
||||
UINT8 gear = myHelpers->ReadByte(0x019B468C, /* isRelativeOffset */ false);
|
||||
|
||||
if (ShowButtonNumbersForSetup == 1)
|
||||
{
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
if (e.jbutton.button >= 0)
|
||||
{
|
||||
char buff[100];
|
||||
sprintf_s(buff, "Button %d Pressed", e.jbutton.button);
|
||||
MessageBoxA(NULL, buff, "", NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
if (ChangeGearsViaPlugin == 1)
|
||||
if (e.jbutton.button >= 0)
|
||||
{
|
||||
if (e.jbutton.button == Gear1)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x00, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear2)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x02, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear3)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x01, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear4)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x03, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearDown) && (gear > 0x00))
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, --gear, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearUp) && (gear < 0x03))
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, ++gear, false);
|
||||
}
|
||||
char buff[100];
|
||||
sprintf_s(buff, "Button %d Pressed", e.jbutton.button);
|
||||
MessageBoxA(NULL, buff, "", NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
if (ChangeGearsViaPlugin == 1)
|
||||
{
|
||||
if (e.jbutton.button == Gear1)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x00, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear2)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x02, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear3)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x01, false);
|
||||
}
|
||||
else if (e.jbutton.button == Gear4)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x03, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearDown) && (gear > 0x00))
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, --gear, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearUp) && (gear < 0x03))
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, ++gear, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI RunningLoop(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ThreadLoop();
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
|
||||
void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
@ -96,8 +105,7 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
init = true;
|
||||
}
|
||||
|
||||
|
@ -30,249 +30,255 @@ static bool HealthB = false;
|
||||
static bool init = false;
|
||||
SDL_Event e;
|
||||
|
||||
static int RunningThread(void *ptr)
|
||||
static int ThreadLoop()
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
INT_PTR Base1p = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x9164, false);
|
||||
INT_PTR Base11p = myHelpers->ReadIntPtr(Base1p + 0x11C, false);
|
||||
INT_PTR Base21p = myHelpers->ReadIntPtr(Base11p + 0x50, false);
|
||||
INT_PTR Base31p = myHelpers->ReadIntPtr(Base21p + 0x20, false);
|
||||
UINT8 Health1p = myHelpers->ReadByte(Base31p + 0x3C, false);
|
||||
UINT8 Bullet1p = myHelpers->ReadByte(Base31p + 0x274, false);
|
||||
UINT8 GrenadeExplode1p = myHelpers->ReadByte(Base31p + 0x2B3, false);
|
||||
INT_PTR Base2p = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x9164, false);
|
||||
INT_PTR Base12p = myHelpers->ReadIntPtr(Base2p + 0x11C, false);
|
||||
INT_PTR Base22p = myHelpers->ReadIntPtr(Base12p + 0x50, false);
|
||||
INT_PTR Base32p = myHelpers->ReadIntPtr(Base22p + 0x38, false);
|
||||
UINT8 Health2p = myHelpers->ReadByte(Base32p + 0x3C, false);
|
||||
UINT8 Bullet2p = myHelpers->ReadByte(Base32p + 0x274, false);
|
||||
UINT8 GrenadeExplode2p = myHelpers->ReadByte(Base32p + 0x2B3, false);
|
||||
UINT8 IngameValue1p = myHelpers->ReadByte(Base31p + 0x38, false);
|
||||
UINT8 IngameValue2p = myHelpers->ReadByte(Base32p + 0x38, false);
|
||||
INT_PTR StartBase = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x3C40, false);
|
||||
INT_PTR StartBase1 = myHelpers->ReadIntPtr(StartBase + 0x130, false);
|
||||
INT_PTR StartBase2 = myHelpers->ReadIntPtr(StartBase1 + 0x234, false);
|
||||
UINT8 StartButton1p = myHelpers->ReadByte(StartBase2 + 0x530, false);
|
||||
UINT8 StartButton2p = myHelpers->ReadByte(StartBase2 + 0x538, false);
|
||||
|
||||
UINT8 static oldHealth1p = 0;
|
||||
UINT8 static oldBullet1p = 0;
|
||||
UINT8 static oldHealth2p = 0;
|
||||
UINT8 static oldBullet2p = 0;
|
||||
UINT8 newHealth1p = Health1p;
|
||||
UINT8 newBullet1p = Bullet1p;
|
||||
UINT8 newHealth2p = Health2p;
|
||||
UINT8 newBullet2p = Bullet2p;
|
||||
|
||||
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
int HowtoRumbleBulletEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleBulletEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleGrenadeEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleGrenadeEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename);
|
||||
int Bullet1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Bullet1pStrength"), 0, settingsFilename);
|
||||
int Grenade1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Grenade1pStrength"), 0, settingsFilename);
|
||||
int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename);
|
||||
int Bullet2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Bullet2pStrength"), 0, settingsFilename);
|
||||
int Grenade2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Grenade2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
if ((Health1p == 0) && (IngameValue1p == 11))
|
||||
{
|
||||
INT_PTR Base1p = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x9164, false);
|
||||
INT_PTR Base11p = myHelpers->ReadIntPtr(Base1p + 0x11C, false);
|
||||
INT_PTR Base21p = myHelpers->ReadIntPtr(Base11p + 0x50, false);
|
||||
INT_PTR Base31p = myHelpers->ReadIntPtr(Base21p + 0x20, false);
|
||||
UINT8 Health1p = myHelpers->ReadByte(Base31p + 0x3C, false);
|
||||
UINT8 Bullet1p = myHelpers->ReadByte(Base31p + 0x274, false);
|
||||
UINT8 GrenadeExplode1p = myHelpers->ReadByte(Base31p + 0x2B3, false);
|
||||
INT_PTR Base2p = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x9164, false);
|
||||
INT_PTR Base12p = myHelpers->ReadIntPtr(Base2p + 0x11C, false);
|
||||
INT_PTR Base22p = myHelpers->ReadIntPtr(Base12p + 0x50, false);
|
||||
INT_PTR Base32p = myHelpers->ReadIntPtr(Base22p + 0x38, false);
|
||||
UINT8 Health2p = myHelpers->ReadByte(Base32p + 0x3C, false);
|
||||
UINT8 Bullet2p = myHelpers->ReadByte(Base32p + 0x274, false);
|
||||
UINT8 GrenadeExplode2p = myHelpers->ReadByte(Base32p + 0x2B3, false);
|
||||
UINT8 IngameValue1p = myHelpers->ReadByte(Base31p + 0x38, false);
|
||||
UINT8 IngameValue2p = myHelpers->ReadByte(Base32p + 0x38, false);
|
||||
INT_PTR StartBase = myHelpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x3C40, false);
|
||||
INT_PTR StartBase1 = myHelpers->ReadIntPtr(StartBase + 0x130, false);
|
||||
INT_PTR StartBase2 = myHelpers->ReadIntPtr(StartBase1 + 0x234, false);
|
||||
UINT8 StartButton1p = myHelpers->ReadByte(StartBase2 + 0x530, false);
|
||||
UINT8 StartButton2p = myHelpers->ReadByte(StartBase2 + 0x538, false);
|
||||
|
||||
UINT8 static oldHealth1p = 0;
|
||||
UINT8 static oldBullet1p = 0;
|
||||
UINT8 static oldHealth2p = 0;
|
||||
UINT8 static oldBullet2p = 0;
|
||||
UINT8 newHealth1p = Health1p;
|
||||
UINT8 newBullet1p = Bullet1p;
|
||||
UINT8 newHealth2p = Health2p;
|
||||
UINT8 newBullet2p = Bullet2p;
|
||||
|
||||
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
int HowtoRumbleBulletEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleBulletEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleGrenadeEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleGrenadeEffect"), 0, settingsFilename);
|
||||
int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename);
|
||||
int Bullet1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Bullet1pStrength"), 0, settingsFilename);
|
||||
int Grenade1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Grenade1pStrength"), 0, settingsFilename);
|
||||
int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename);
|
||||
int Bullet2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Bullet2pStrength"), 0, settingsFilename);
|
||||
int Grenade2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Grenade2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
if ((Health1p == 0) && (IngameValue1p == 11))
|
||||
if (!HealthA)
|
||||
{
|
||||
if (!HealthA)
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
HealthA = true;
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
HealthA = true;
|
||||
}
|
||||
|
||||
if ((Health2p == 0) && (IngameValue2p == 11))
|
||||
{
|
||||
if (!HealthB)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
HealthB = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((IngameValue1p == 3) && (StartButton1p != 0x80))
|
||||
{
|
||||
if (oldHealth1p != newHealth1p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (oldBullet1p != newBullet1p)
|
||||
{
|
||||
if (HowtoRumbleBulletEffect == 0)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 1)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 2)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (GrenadeExplode1p == 0x42)
|
||||
{
|
||||
if (HowtoRumbleGrenadeEffect == 0)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 1)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 2)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
HealthA = false;
|
||||
}
|
||||
|
||||
if ((IngameValue2p == 3) && (StartButton2p != 0x80))
|
||||
{
|
||||
if (oldHealth2p != newHealth2p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (oldBullet2p != newBullet2p)
|
||||
{
|
||||
if (HowtoRumbleBulletEffect == 0)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 1)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 2)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (GrenadeExplode2p == 0x42)
|
||||
{
|
||||
if (HowtoRumbleGrenadeEffect == 0)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 1)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 2)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
HealthB = false;
|
||||
}
|
||||
oldHealth1p = newHealth1p;
|
||||
oldBullet1p = newBullet1p;
|
||||
oldHealth2p = newHealth2p;
|
||||
oldBullet2p = newBullet2p;
|
||||
}
|
||||
|
||||
if ((Health2p == 0) && (IngameValue2p == 11))
|
||||
{
|
||||
if (!HealthB)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
HealthB = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((IngameValue1p == 3) && (StartButton1p != 0x80))
|
||||
{
|
||||
if (oldHealth1p != newHealth1p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (oldBullet1p != newBullet1p)
|
||||
{
|
||||
if (HowtoRumbleBulletEffect == 0)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 1)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 2)
|
||||
{
|
||||
double percentForce = ((Bullet1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (GrenadeExplode1p == 0x42)
|
||||
{
|
||||
if (HowtoRumbleGrenadeEffect == 0)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 1)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 2)
|
||||
{
|
||||
double percentForce = ((Grenade1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
HealthA = false;
|
||||
}
|
||||
|
||||
if ((IngameValue2p == 3) && (StartButton2p != 0x80))
|
||||
{
|
||||
if (oldHealth2p != newHealth2p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (oldBullet2p != newBullet2p)
|
||||
{
|
||||
if (HowtoRumbleBulletEffect == 0)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 1)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleBulletEffect == 2)
|
||||
{
|
||||
double percentForce = ((Bullet2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
if (GrenadeExplode2p == 0x42)
|
||||
{
|
||||
if (HowtoRumbleGrenadeEffect == 0)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 1)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGrenadeEffect == 2)
|
||||
{
|
||||
double percentForce = ((Grenade2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
myTriggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
HealthB = false;
|
||||
}
|
||||
oldHealth1p = newHealth1p;
|
||||
oldBullet1p = newBullet1p;
|
||||
oldHealth2p = newHealth2p;
|
||||
oldBullet2p = newBullet2p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI RunningLoop(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ThreadLoop();
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
|
||||
void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
if (!init)
|
||||
@ -280,8 +286,7 @@ void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
SDL_Thread* thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void*)NULL);
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
|
@ -20,6 +20,7 @@ extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static bool init = false;
|
||||
|
||||
void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
int ff = helpers->ReadIntPtr(0x0063BF5C, /* isRelativeOffset */ true);
|
||||
@ -50,47 +51,51 @@ void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers*
|
||||
int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
if (!init)
|
||||
{
|
||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
continue;
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
|
@ -20,6 +20,7 @@ extern int joystick_index2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
static bool init = false;
|
||||
|
||||
void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
@ -51,47 +52,51 @@ void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
int Motor2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Motor2pStrength"), 0, settingsFilename);
|
||||
int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
if (!init)
|
||||
{
|
||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
continue;
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
if ((oldFloat1 != newFloat1) && (health1p != 0x1))
|
||||
|
@ -19,6 +19,7 @@ static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
static bool init = false;
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||
static int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
||||
@ -30,174 +31,189 @@ static int Gear5 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear5"), 0, sett
|
||||
static int Gear6 = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gear6"), 0, settingsFilename);
|
||||
static int SpeedStrength;
|
||||
|
||||
static int RunningThread(void *ptr)
|
||||
static int ThreadLoop()
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
{
|
||||
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||
int ffwall = myHelpers->ReadInt32(0x08273FAC, /* isRelativeOffset */ false);
|
||||
int ff3 = myHelpers->ReadInt32(0x0827A1DA, /* isRelativeOffset */ false);
|
||||
int ff4 = myHelpers->ReadInt32(0x0827A35D, /* isRelativeOffset */ false);
|
||||
int ff5 = myHelpers->ReadInt32(0x0827A1D4, /* isRelativeOffset */ false);
|
||||
UINT8 ff6 = myHelpers->ReadByte(0x08670DC8, /* isRelativeOffset */ false); // steering
|
||||
float ff7 = myHelpers->ReadFloat32(0x08273AD4, /* isRelativeOffset */ false);
|
||||
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||
UINT8 ff9 = myHelpers->ReadByte(0x086749CA, /* isRelativeOffset */ false); // 1 when menu
|
||||
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||
UINT8 static oldgear = 0;
|
||||
int static oldFloat = 0.0;
|
||||
int newFloat = ff3;
|
||||
int static oldFloat1 = 0.0;
|
||||
int newFloat1 = ff4;
|
||||
float newgear = gear;
|
||||
|
||||
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||
{
|
||||
SpeedStrength = 10;
|
||||
}
|
||||
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||
{
|
||||
SpeedStrength = 20;
|
||||
}
|
||||
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||
{
|
||||
SpeedStrength = 30;
|
||||
}
|
||||
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||
{
|
||||
SpeedStrength = 40;
|
||||
}
|
||||
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||
{
|
||||
SpeedStrength = 50;
|
||||
}
|
||||
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||
{
|
||||
SpeedStrength = 60;
|
||||
}
|
||||
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||
{
|
||||
SpeedStrength = 70;
|
||||
}
|
||||
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||
{
|
||||
SpeedStrength = 80;
|
||||
}
|
||||
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||
{
|
||||
SpeedStrength = 90;
|
||||
}
|
||||
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||
{
|
||||
SpeedStrength = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpeedStrength = 0;
|
||||
}
|
||||
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||
int ffwall = myHelpers->ReadInt32(0x08273FAC, /* isRelativeOffset */ false);
|
||||
int ff3 = myHelpers->ReadInt32(0x0827A1DA, /* isRelativeOffset */ false);
|
||||
int ff4 = myHelpers->ReadInt32(0x0827A35D, /* isRelativeOffset */ false);
|
||||
int ff5 = myHelpers->ReadInt32(0x0827A1D4, /* isRelativeOffset */ false);
|
||||
UINT8 ff6 = myHelpers->ReadByte(0x08670DC8, /* isRelativeOffset */ false); // steering
|
||||
float ff7 = myHelpers->ReadFloat32(0x08273AD4, /* isRelativeOffset */ false);
|
||||
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||
UINT8 ff9 = myHelpers->ReadByte(0x086749CA, /* isRelativeOffset */ false); // 1 when menu
|
||||
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||
UINT8 static oldgear = 0;
|
||||
int static oldFloat = 0.0;
|
||||
int newFloat = ff3;
|
||||
int static oldFloat1 = 0.0;
|
||||
int newFloat1 = ff4;
|
||||
float newgear = gear;
|
||||
|
||||
if (ff8 == 1)
|
||||
{
|
||||
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||
{
|
||||
double percentForce = ((127 - ff6) / 127.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||
{
|
||||
double percentForce = ((ff6 - 127) / 128.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
if (ff9 == 1)
|
||||
{
|
||||
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||
{
|
||||
double percentForce = ((127 - ff6) / 127.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
if ((ff6 > 0x7F) & (ff6 < 0x100))
|
||||
{
|
||||
double percentForce = ((ff6 - 127) / 128.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
if (ff5 == 2)
|
||||
{
|
||||
if (oldFloat != newFloat)
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff5 == 1)
|
||||
{
|
||||
if (oldFloat != newFloat)
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldFloat1 != newFloat1)
|
||||
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||
{
|
||||
SpeedStrength = 10;
|
||||
}
|
||||
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||
{
|
||||
SpeedStrength = 20;
|
||||
}
|
||||
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||
{
|
||||
SpeedStrength = 30;
|
||||
}
|
||||
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||
{
|
||||
SpeedStrength = 40;
|
||||
}
|
||||
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||
{
|
||||
SpeedStrength = 50;
|
||||
}
|
||||
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||
{
|
||||
SpeedStrength = 60;
|
||||
}
|
||||
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||
{
|
||||
SpeedStrength = 70;
|
||||
}
|
||||
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||
{
|
||||
SpeedStrength = 80;
|
||||
}
|
||||
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||
{
|
||||
SpeedStrength = 90;
|
||||
}
|
||||
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||
{
|
||||
SpeedStrength = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpeedStrength = 0;
|
||||
}
|
||||
|
||||
if (ff8 == 1)
|
||||
{
|
||||
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||
{
|
||||
double percentForce = ((127 - ff6) / 127.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
if ((ff6 > 0x7F)& (ff6 < 0x100))
|
||||
{
|
||||
double percentForce = ((ff6 - 127) / 128.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
if (ff9 == 1)
|
||||
{
|
||||
if ((ff6 >= 0x00) & (ff6 < 0x7F))
|
||||
{
|
||||
double percentForce = ((127 - ff6) / 127.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
if ((ff6 > 0x7F)& (ff6 < 0x100))
|
||||
{
|
||||
double percentForce = ((ff6 - 127) / 128.0);
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
if (ff5 == 2)
|
||||
{
|
||||
if (oldFloat != newFloat)
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(200, 200, percentForce);
|
||||
}
|
||||
else if (ff == 8)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.1;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(70, 70, percentForce);
|
||||
}
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if (ff == 4)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.2;
|
||||
double percentLength = 50;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff == 16)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.2;
|
||||
double percentLength = 50;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(100, 50, percentForce);
|
||||
}
|
||||
}
|
||||
oldFloat = newFloat;
|
||||
oldFloat1 = newFloat1;
|
||||
}
|
||||
else if (ff5 == 1)
|
||||
{
|
||||
if (oldFloat != newFloat)
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldFloat1 != newFloat1)
|
||||
{
|
||||
double percentForce = SpeedStrength / 100.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(200, 200, percentForce);
|
||||
}
|
||||
else if (ff == 8)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.1;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(70, 70, percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff == 4)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.2;
|
||||
double percentLength = 50;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(50, 50, percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff == 16)
|
||||
{
|
||||
if (SpeedStrength > 0)
|
||||
{
|
||||
double percentForce = 0.2;
|
||||
double percentLength = 50;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(100, 50, percentForce);
|
||||
}
|
||||
}
|
||||
|
||||
oldFloat = newFloat;
|
||||
oldFloat1 = newFloat1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI RunningLoop(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ThreadLoop();
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
|
||||
void OutRun2Fake::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
|
||||
if (!init)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
init = true;
|
||||
}
|
||||
|
||||
int ff = myHelpers->ReadInt32(0x0827A1A0, /* isRelativeOffset */ false);
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
|
@ -19,6 +19,7 @@ static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
static bool init = false;
|
||||
static int SpeedStrength;
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||
@ -84,80 +85,90 @@ signed int cdecl or2FfbFunction(unsigned __int8 unk1, unsigned __int8 unk2, unsi
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int RunningThread(void *ptr)
|
||||
static int ThreadLoop()
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||
UINT8 static oldgear = 0;
|
||||
float newgear = gear;
|
||||
|
||||
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||
{
|
||||
UINT8 gear = myHelpers->ReadByte(0x0827A160, /* isRelativeOffset */ false); // gear address
|
||||
UINT8 ff8 = myHelpers->ReadByte(0x08304ADC, /* isRelativeOffset */ false); // 1 when race
|
||||
float ffspeed = myHelpers->ReadFloat32(0x08273DF0, /* isRelativeOffset */ false); //speedo
|
||||
UINT8 static oldgear = 0;
|
||||
float newgear = gear;
|
||||
|
||||
if ((ffspeed >= 0.1) && (ffspeed <= 80))
|
||||
{
|
||||
SpeedStrength = 10;
|
||||
}
|
||||
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||
{
|
||||
SpeedStrength = 20;
|
||||
}
|
||||
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||
{
|
||||
SpeedStrength = 30;
|
||||
}
|
||||
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||
{
|
||||
SpeedStrength = 40;
|
||||
}
|
||||
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||
{
|
||||
SpeedStrength = 50;
|
||||
}
|
||||
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||
{
|
||||
SpeedStrength = 60;
|
||||
}
|
||||
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||
{
|
||||
SpeedStrength = 70;
|
||||
}
|
||||
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||
{
|
||||
SpeedStrength = 80;
|
||||
}
|
||||
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||
{
|
||||
SpeedStrength = 90;
|
||||
}
|
||||
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||
{
|
||||
SpeedStrength = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpeedStrength = 0;
|
||||
}
|
||||
|
||||
if ((oldgear != newgear) && (ff8 == 1) && (ffspeed >= 0.1))
|
||||
{
|
||||
double percentForce = 0.1;
|
||||
double percentLength = 100;
|
||||
myTriggers->Sine(240, 320, percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
oldgear = newgear;
|
||||
SpeedStrength = 10;
|
||||
}
|
||||
else if ((ffspeed >= 80.1) && (ffspeed <= 130))
|
||||
{
|
||||
SpeedStrength = 20;
|
||||
}
|
||||
else if ((ffspeed >= 130.1) && (ffspeed <= 180))
|
||||
{
|
||||
SpeedStrength = 30;
|
||||
}
|
||||
else if ((ffspeed >= 180.1) && (ffspeed <= 220))
|
||||
{
|
||||
SpeedStrength = 40;
|
||||
}
|
||||
else if ((ffspeed >= 220.1) && (ffspeed <= 270))
|
||||
{
|
||||
SpeedStrength = 50;
|
||||
}
|
||||
else if ((ffspeed >= 270.1) && (ffspeed <= 320))
|
||||
{
|
||||
SpeedStrength = 60;
|
||||
}
|
||||
else if ((ffspeed >= 320.1) && (ffspeed <= 380))
|
||||
{
|
||||
SpeedStrength = 70;
|
||||
}
|
||||
else if ((ffspeed >= 380.1) && (ffspeed <= 430))
|
||||
{
|
||||
SpeedStrength = 80;
|
||||
}
|
||||
else if ((ffspeed >= 430.1) && (ffspeed <= 500))
|
||||
{
|
||||
SpeedStrength = 90;
|
||||
}
|
||||
else if ((ffspeed >= 500.1) && (ffspeed <= 1000))
|
||||
{
|
||||
SpeedStrength = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpeedStrength = 0;
|
||||
}
|
||||
|
||||
if ((oldgear != newgear) && (ff8 == 1) && (ffspeed >= 0.1))
|
||||
{
|
||||
double percentForce = 0.1;
|
||||
double percentLength = 100;
|
||||
myTriggers->Sine(240, 320, percentForce);
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
|
||||
oldgear = newgear;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI RunningLoop(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ThreadLoop();
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
|
||||
void OutRun2Real::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
|
||||
if (!init)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
init = true;
|
||||
}
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
|
@ -51,6 +51,8 @@ static bool DirtDevilSine = false;
|
||||
static bool ForceSpringEffect = false;
|
||||
static bool DontSineUntilRaceStart = false;
|
||||
static bool HardDrivinFrame = false;
|
||||
static bool Motion = false;
|
||||
static bool MotionFalse = false;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HINSTANCE hPrevInstance;
|
||||
@ -67,8 +69,11 @@ char* Emulator;
|
||||
int vals[8] = { 0 };
|
||||
int frame = 0;
|
||||
int HardDrivinFFB;
|
||||
int StopConstant;
|
||||
int newstateFFB;
|
||||
int stateFFB;
|
||||
int stateFFB2;
|
||||
int stateFFB3;
|
||||
int stateFFBDevice2;
|
||||
int stateFFBDevice3;
|
||||
|
||||
@ -275,6 +280,8 @@ int __stdcall mame_stop(void)
|
||||
|
||||
AppendTextToEditCtrl(hEdit, TEXT("mame_stop\r\n"));
|
||||
|
||||
StopConstant = 255;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1918,6 +1925,8 @@ std::string SanFran2049Active("SanFran2049Active");
|
||||
std::string HardDrivinActive("HardDrivinActive");
|
||||
std::string EffectActive("EffectActive");
|
||||
std::string EffectActive2("EffectActive2");
|
||||
std::string OutrunActive("OutrunActive");
|
||||
std::string PDriftActive("PDriftActive");
|
||||
|
||||
//Names of FFB Outputs
|
||||
std::string RawDrive("RawDrive");
|
||||
@ -1926,6 +1935,7 @@ std::string wheel("wheel");
|
||||
std::string lamp1("lamp1");
|
||||
std::string led2("led2");
|
||||
std::string Vibration_motor("Vibration_motor");
|
||||
std::string vibration_motor("vibration_motor");
|
||||
std::string Wheel_vibration("Wheel_vibration");
|
||||
std::string upright_wheel_motor("upright_wheel_motor");
|
||||
std::string MA_Steering_Wheel_motor("MA_Steering_Wheel_motor");
|
||||
@ -1943,6 +1953,9 @@ std::string P3_Gun_Recoil("P3_Gun_Recoil");
|
||||
std::string P1_gun_recoil("P1_gun_recoil");
|
||||
std::string P2_gun_recoil("P2_gun_recoil");
|
||||
std::string mcuout1("mcuout1");
|
||||
std::string Bank_Motor_Speed("Bank_Motor_Speed");
|
||||
std::string Bank_Motor_Direction("Bank_Motor_Direction");
|
||||
std::string bank_motor_position("bank_motor_position");
|
||||
|
||||
//Emulator Name
|
||||
std::string MAME("MAME");
|
||||
@ -1959,10 +1972,7 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
CreateThread(NULL, 0, ThreadForForcedSpring, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
@ -2050,6 +2060,10 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
SDL_HapticSetGain(haptic3, 100);
|
||||
}
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
|
||||
if (EnableForceSpringEffect == 1)
|
||||
{
|
||||
if (ForceSpringEffect)
|
||||
@ -2134,14 +2148,34 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
romname == spacegunj || romname == term2 || romname == term2la1 || romname == term2la2 || romname == term2la3 || romname == term2lg1 || romname == rchase || romname == rchasej ||
|
||||
romname == lghost || romname == lghostd || romname == lghostu || romname == lghostud || romname == lghostj || romname == timecris || romname == timecrisa || romname == othunder ||
|
||||
romname == othundero || romname == othunderuo || romname == othunderu || romname == othunderj || romname == opwolf || romname == opwolfp || romname == opwolfj || romname == opwolfu ||
|
||||
romname == opwolfa || romname == orunners || romname == orunnersu || romname == orunnersj || romname == pdrift || romname == pdrifta || romname == pdrifte || romname == pdriftj ||
|
||||
romname == pdriftl || romname == outrunra || romname == outrun || romname == outruneh || romname == toutrun || romname == toutrund || romname == toutrunj || romname == toutrunjd ||
|
||||
romname == opwolfa || romname == orunners || romname == orunnersu || romname == orunnersj || romname == toutrun || romname == toutrund || romname == toutrunj || romname == toutrunjd ||
|
||||
romname == undrfire || romname == undrfireu || romname == undrfirej || romname == cbombers || romname == cbombersj || romname == cbombersp)
|
||||
{
|
||||
RunningFFB = "EffectActive";
|
||||
}
|
||||
|
||||
if (romname == aburner2 || romname == aburner2g || romname == cischeat || romname == f1gpstar || romname == f1gpstaro || romname == f1gpstr2 )
|
||||
//if (MotionFFB == 1)
|
||||
//{
|
||||
if (romname == outrunra || romname == outrun || romname == outruneh)
|
||||
{
|
||||
RunningFFB = "OutrunActive";
|
||||
}
|
||||
|
||||
if (romname == pdrift || romname == pdrifta || romname == pdrifte || romname == pdriftj || romname == pdriftl)
|
||||
{
|
||||
RunningFFB = "PDriftActive";
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (romname == outrunra || romname == outrun || romname == outruneh || romname == pdrift || romname == pdrifta || romname == pdrifte || romname == pdriftj ||
|
||||
// romname == pdriftl)
|
||||
// {
|
||||
// RunningFFB = "EffectActive";
|
||||
// }
|
||||
//}
|
||||
|
||||
if (romname == aburner2 || romname == aburner2g || romname == cischeat || romname == f1gpstar || romname == f1gpstaro || romname == f1gpstr2)
|
||||
{
|
||||
RunningFFB = "EffectActive2";
|
||||
}
|
||||
@ -2181,7 +2215,7 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
}
|
||||
}
|
||||
|
||||
if ((RunningFFB != NULL) && (RunningFFB[0] != '\0'))
|
||||
if (RomGameName && EmuName)
|
||||
{
|
||||
if (RunningFFB == Daytona2Active) //Daytona 2,Scud Race,Le Mans 24
|
||||
{
|
||||
@ -2722,6 +2756,210 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
}
|
||||
}
|
||||
|
||||
if (RunningFFB == OutrunActive)
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == Bank_Motor_Direction)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
if (newstateFFB != 0)
|
||||
{
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
}
|
||||
|
||||
if (name == Vibration_motor)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
if (newstateFFB == 0)
|
||||
{
|
||||
Effect1 = false;
|
||||
}
|
||||
|
||||
stateFFB2 = newstateFFB;
|
||||
}
|
||||
|
||||
if (name == Bank_Motor_Speed)
|
||||
{
|
||||
stateFFB3 = newstateFFB;
|
||||
}
|
||||
|
||||
if (Motion)
|
||||
{
|
||||
if (stateFFB == 0x01)
|
||||
{
|
||||
double percentForce = (1 + stateFFB3) / 8.0;
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
if (stateFFB == 0x02)
|
||||
{
|
||||
double percentForce = (1 + stateFFB3) / 8.0;
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
|
||||
if (stateFFB == 1)
|
||||
{
|
||||
Motion = true;
|
||||
MotionFalse = false;
|
||||
}
|
||||
|
||||
if (stateFFB2 == 1)
|
||||
{
|
||||
Motion = false;
|
||||
}
|
||||
|
||||
if (StopConstant == 255)
|
||||
{
|
||||
MotionFalse = true;
|
||||
}
|
||||
|
||||
if (MotionFalse)
|
||||
{
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0);
|
||||
Motion = false;
|
||||
StopConstant = 0;
|
||||
MotionFalse = false;
|
||||
}
|
||||
|
||||
if (!Motion)
|
||||
{
|
||||
|
||||
if (stateFFB2 == 0x01)
|
||||
{
|
||||
Effect1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Effect1 = false;
|
||||
}
|
||||
|
||||
if (Effect1)
|
||||
{
|
||||
triggers->Sine(SinePeriod, SineFadePeriod, SineStrength / 100.0);
|
||||
triggers->Rumble(RumbleStrengthLeftMotor / 100.0, RumbleStrengthRightMotor / 100.0, 100);
|
||||
}
|
||||
|
||||
if (!Effect1)
|
||||
{
|
||||
triggers->Sine(0, 0, 0);
|
||||
triggers->Rumble(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RunningFFB == PDriftActive)
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == bank_motor_position)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
if (name == vibration_motor)
|
||||
{
|
||||
stateFFB2 = newstateFFB;
|
||||
}
|
||||
|
||||
if (name == upright_wheel_motor)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
if (newstateFFB == 0)
|
||||
{
|
||||
Effect1 = false;
|
||||
}
|
||||
|
||||
stateFFB3 = newstateFFB;
|
||||
}
|
||||
|
||||
if (Motion)
|
||||
{
|
||||
if ((stateFFB > 0x00) && (stateFFB < 0x04))
|
||||
{
|
||||
double percentForce = (4 - stateFFB) / 3.0;
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((stateFFB > 0x04) && (stateFFB < 0x08))
|
||||
{
|
||||
double percentForce = (stateFFB - 4) / 3.0;
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
|
||||
if (stateFFB2 >= 0)
|
||||
{
|
||||
double percentForce = stateFFB2 / 7.0;
|
||||
triggers->Sine(60, 0, percentForce / 3.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (stateFFB == 4)
|
||||
{
|
||||
Motion = true;
|
||||
MotionFalse = false;
|
||||
}
|
||||
|
||||
if (stateFFB3 == 1)
|
||||
{
|
||||
Motion = false;
|
||||
}
|
||||
|
||||
if (StopConstant == 255)
|
||||
{
|
||||
MotionFalse = true;
|
||||
}
|
||||
|
||||
if (MotionFalse)
|
||||
{
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, 0);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0);
|
||||
Motion = false;
|
||||
StopConstant = 0;
|
||||
MotionFalse = false;
|
||||
}
|
||||
|
||||
if (!Motion)
|
||||
{
|
||||
if (stateFFB3 == 0x01)
|
||||
{
|
||||
Effect1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Effect1 = false;
|
||||
}
|
||||
|
||||
if (Effect1)
|
||||
{
|
||||
triggers->Sine(SinePeriod, SineFadePeriod, SineStrength / 100.0);
|
||||
triggers->Rumble(RumbleStrengthLeftMotor / 100.0, RumbleStrengthRightMotor / 100.0, 100);
|
||||
}
|
||||
|
||||
if (!Effect1)
|
||||
{
|
||||
triggers->Sine(0, 0, 0);
|
||||
triggers->Rumble(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RunningFFB == SanFran2049Active) //San Fran 2049
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
|
@ -16,7 +16,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
void PokkenTournament::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
|
||||
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);
|
||||
|
258
Game Files/Rambo.cpp
Normal file
258
Game Files/Rambo.cpp
Normal file
@ -0,0 +1,258 @@
|
||||
/*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 <string>
|
||||
#include "Rambo.h"
|
||||
#include "SDL.h"
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
extern HINSTANCE gl_cgGLDll;
|
||||
static bool init = false;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
static int HowtoRumbleGunEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleGunEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleRageEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleRageEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename);
|
||||
static int Gun1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun1pStrength"), 0, settingsFilename);
|
||||
static int Rage1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rage1pStrength"), 0, settingsFilename);
|
||||
static int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename);
|
||||
static int Gun2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun2pStrength"), 0, settingsFilename);
|
||||
static int Rage2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rage2pStrength"), 0, settingsFilename);
|
||||
static int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
void Rambo::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
INT_PTR Base1p = helpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x1C4E8, false);
|
||||
INT_PTR Base11p = helpers->ReadIntPtr(Base1p + 0x5BC, false);
|
||||
INT_PTR Base21p = helpers->ReadIntPtr(Base11p + 0x77C, false);
|
||||
INT_PTR Base31p = helpers->ReadIntPtr(Base21p + 0x0, false);
|
||||
INT_PTR Base41p = helpers->ReadIntPtr(Base31p + 0x20, false);
|
||||
UINT8 Health1p = helpers->ReadByte(Base41p + 0x3C, false);
|
||||
UINT8 Ammo1p = helpers->ReadByte(Base41p + 0x400, false);
|
||||
float Rage1p = helpers->ReadFloat32(Base41p + 0x68, false);
|
||||
|
||||
INT_PTR Base2p = helpers->ReadIntPtr((INT_PTR)gl_cgGLDll + 0x9144, false);
|
||||
INT_PTR Base12p = helpers->ReadIntPtr(Base2p + 0x4F4, false);
|
||||
INT_PTR Base22p = helpers->ReadIntPtr(Base12p + 0x278, false);
|
||||
INT_PTR Base32p = helpers->ReadIntPtr(Base22p + 0x1B0, false);
|
||||
INT_PTR Base42p = helpers->ReadIntPtr(Base32p + 0x38, false);
|
||||
UINT8 Health2p = helpers->ReadByte(Base42p + 0x3C, false);
|
||||
UINT8 Ammo2p = helpers->ReadByte(Base42p + 0x400, false);
|
||||
float Rage2p = helpers->ReadFloat32(Base42p + 0x68, false);
|
||||
|
||||
static UINT8 oldHealth1p = 0;
|
||||
static UINT8 oldAmmo1p = 0;
|
||||
static UINT8 oldHealth2p = 0;
|
||||
static UINT8 oldAmmo2p = 0;
|
||||
static float oldRage1p = 0;
|
||||
static float oldRage2p = 0;
|
||||
UINT8 newHealth1p = Health1p;
|
||||
UINT8 newAmmo1p = Ammo1p;
|
||||
UINT8 newHealth2p = Health2p;
|
||||
UINT8 newAmmo2p = Ammo2p;
|
||||
float newRage1p = Rage1p;
|
||||
float newRage2p = Rage2p;
|
||||
|
||||
if (!init)
|
||||
{
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
if (oldHealth1p != newHealth1p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth2p != newHealth2p)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldAmmo1p != newAmmo1p)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldAmmo2p != newAmmo2p)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldRage1p != newRage1p)
|
||||
{
|
||||
if (HowtoRumbleRageEffect == 0)
|
||||
{
|
||||
double percentForce = ((Rage1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleRageEffect == 1)
|
||||
{
|
||||
double percentForce = ((Rage1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleRageEffect == 2)
|
||||
{
|
||||
double percentForce = ((Rage1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldRage2p != newRage2p)
|
||||
{
|
||||
if (HowtoRumbleRageEffect == 0)
|
||||
{
|
||||
double percentForce = ((Rage2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleRageEffect == 1)
|
||||
{
|
||||
double percentForce = ((Rage2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleRageEffect == 2)
|
||||
{
|
||||
double percentForce = ((Rage2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
oldHealth1p = newHealth1p;
|
||||
oldAmmo1p = newAmmo1p;
|
||||
oldRage1p = newRage1p;
|
||||
oldHealth2p = newHealth2p;
|
||||
oldAmmo2p = newAmmo2p;
|
||||
oldRage2p = newRage2p;
|
||||
}
|
20
Game Files/Rambo.h
Normal file
20
Game Files/Rambo.h
Normal file
@ -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 Rambo : public Game {
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
@ -33,6 +33,7 @@ static bool leverdownA;
|
||||
static bool leverleftA;
|
||||
static bool leverrightA;
|
||||
static bool stophack;
|
||||
static bool init = false;
|
||||
static SDL_Event e;
|
||||
|
||||
static void MEMwrite(void *adr, void *ptr, int size)
|
||||
@ -80,192 +81,233 @@ static int leverDownDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("lever
|
||||
static int leverLeftDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverLeftDevice2"), 0, settingsFilename);
|
||||
static int leverRightDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("leverRightDevice2"), 0, settingsFilename);
|
||||
|
||||
static int RunningThread(void *ptr)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt >= 0; ++cnt)
|
||||
static int ThreadLoop()
|
||||
{
|
||||
int menuvalue = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x0094BFFC, false);
|
||||
int menuvalue1 = myHelpers->ReadIntPtr((INT_PTR)menuvalue + 0x46C, false);
|
||||
int serviceread3 = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, false);
|
||||
int timer = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x954394, false);
|
||||
int cabid = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x951034, false);
|
||||
int cabid2 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x952B9C, false);
|
||||
float timeroutofmenu = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x94BEE8, false);
|
||||
uintptr_t jgtBase;
|
||||
jgtBase = (uintptr_t)GetModuleHandleA("jgt.dll");
|
||||
|
||||
if (CabinetID == 2)
|
||||
{
|
||||
int menuvalue = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x0094BFFC, false);
|
||||
int menuvalue1 = myHelpers->ReadIntPtr((INT_PTR)menuvalue + 0x46C, false);
|
||||
int serviceread3 = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, false);
|
||||
int timer = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x954394, false);
|
||||
int cabid = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x951034, false);
|
||||
int cabid2 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x952B9C, false);
|
||||
float timeroutofmenu = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x94BEE8, false);
|
||||
uintptr_t jgtBase;
|
||||
jgtBase = (uintptr_t)GetModuleHandleA("jgt.dll");
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x01", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
}
|
||||
else if (CabinetID == 3)
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x02", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
}
|
||||
else if (CabinetID == 4)
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x03", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x00", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x74", 1);
|
||||
}
|
||||
|
||||
if (CabinetID == 2)
|
||||
if (HackToCloseLibmovieErrorAuto == 1)
|
||||
{
|
||||
//Remove fucken window error popup
|
||||
HWND hWnd = FindWindowA(0, ("Libmovie Error Report"));
|
||||
if (hWnd > NULL)
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x01", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
||||
}
|
||||
else if (CabinetID == 3)
|
||||
}
|
||||
if (HackToSkipMenuError == 1)
|
||||
{
|
||||
// Hack to quickly bypass error at start
|
||||
if (avoiderror)
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x02", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
}
|
||||
else if (CabinetID == 4)
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x03", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x75", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MEMwrite((void*)(jgtBase + 0x951034), (void*)"\x00", 1);
|
||||
MEMwrite((void*)(jgtBase + 0x42EBB9), (void*)"\x74", 1);
|
||||
}
|
||||
|
||||
if (HackToCloseLibmovieErrorAuto == 1)
|
||||
{
|
||||
//Remove fucken window error popup
|
||||
HWND hWnd = FindWindowA(0, ("Libmovie Error Report"));
|
||||
if (hWnd > NULL)
|
||||
if (cabid > 0)
|
||||
{
|
||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
||||
}
|
||||
}
|
||||
if (HackToSkipMenuError == 1)
|
||||
{
|
||||
// Hack to quickly bypass error at start
|
||||
if (avoiderror)
|
||||
{
|
||||
if (cabid > 0)
|
||||
if (menuvalue1 > 700000)
|
||||
{
|
||||
if (menuvalue1 > 700000)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false);
|
||||
}
|
||||
if (menuvalue1 == 0)
|
||||
{
|
||||
SDL_Delay(50);
|
||||
myHelpers->WriteIntPtr((INT_PTR)menuvalue + 0x46C, 0x0F, false);
|
||||
}
|
||||
if (menuvalue1 == 15)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false);
|
||||
}
|
||||
if (timeroutofmenu != 0)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x00, false);
|
||||
avoiderror = false;
|
||||
}
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x02, false);
|
||||
}
|
||||
else
|
||||
if (menuvalue1 == 0)
|
||||
{
|
||||
if (menuvalue1 > 700000)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false);
|
||||
}
|
||||
if (timeroutofmenu != 0)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B39, 0x7F, false);
|
||||
avoiderror = false;
|
||||
}
|
||||
SDL_Delay(50);
|
||||
myHelpers->WriteIntPtr((INT_PTR)menuvalue + 0x46C, 0x0F, false);
|
||||
}
|
||||
if (menuvalue1 == 15)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false);
|
||||
}
|
||||
if (timeroutofmenu != 0)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x00, false);
|
||||
avoiderror = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (menuvalue1 > 700000)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x01, false);
|
||||
}
|
||||
if (timeroutofmenu != 0)
|
||||
{
|
||||
myHelpers->WriteIntPtr((INT_PTR)gl_hjgtDll + 0x7D2B24, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B39, 0x7F, false);
|
||||
avoiderror = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Only2D == 1)
|
||||
if (Only2D == 1)
|
||||
{
|
||||
//2D Only
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24C9F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CA0, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CA1, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x478F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x4790, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x4791, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DD, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391D8, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391D9, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391DA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391EF, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391F0, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391F1, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x5962F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x59630, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x59631, false);
|
||||
int TwoDee1 = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00946DA0, false);
|
||||
int TwoDee2 = myHelpers->ReadIntPtr((INT_PTR)TwoDee1 + 0x38, false);
|
||||
int TwoDee3 = myHelpers->ReadIntPtr((INT_PTR)TwoDee2 + 0x94, false);
|
||||
myHelpers->WriteIntPtr((INT_PTR)TwoDee3 + 0x74, 0x00, false);
|
||||
}
|
||||
if (InputDeviceWheelEnable == 1)
|
||||
{
|
||||
//Write New Calibration Values
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B00, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B01, 0x7F, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B0C, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B0D, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B14, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B15, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B10, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B11, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B21, 0x00, false);
|
||||
|
||||
// Remove error flashing
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951154, 0x01, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951155, 0x01, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951156, 0x01, false);
|
||||
}
|
||||
|
||||
UINT8 ff1 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BB9, false);
|
||||
UINT8 ff2 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBA, false);
|
||||
UINT8 ff3 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBB, false);
|
||||
UINT8 ff4 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBC, false);
|
||||
//Change timer back to 0 when test menu & FFB Only while timer above 0
|
||||
if ((timer != 0) || (menuvalue1 == 0x00))
|
||||
{
|
||||
if (menuvalue1 == 0x00)
|
||||
{
|
||||
//2D Only
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24C9F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CA0, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CA1, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CAC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x24CBC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x478F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x4790, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x4791, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DB, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DC, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x3E6DD, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391D8, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391D9, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391DA, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391EF, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391F0, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x1391F1, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x5962F, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x59630, false);
|
||||
myHelpers->WriteNop((INT_PTR)gl_hjgtDll + 0x59631, false);
|
||||
int TwoDee1 = myHelpers->ReadIntPtr((INT_PTR)gl_hjgtDll + 0x00946DA0, false);
|
||||
int TwoDee2 = myHelpers->ReadIntPtr((INT_PTR)TwoDee1 + 0x38, false);
|
||||
int TwoDee3 = myHelpers->ReadIntPtr((INT_PTR)TwoDee2 + 0x94, false);
|
||||
myHelpers->WriteIntPtr((INT_PTR)TwoDee3 + 0x74, 0x00, false);
|
||||
myHelpers->WriteFloat32((INT_PTR)gl_hjgtDll + 0x954394, 0, false);
|
||||
}
|
||||
if (InputDeviceWheelEnable == 1)
|
||||
if ((ff3 != 0x00) && (ff4 != 0x00))
|
||||
{
|
||||
//Write New Calibration Values
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B00, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B01, 0x7F, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B0C, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B0D, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B14, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B15, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B10, 0x00, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B11, 0xFF, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x7D2B21, 0x00, false);
|
||||
|
||||
// Remove error flashing
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951154, 0x01, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951155, 0x01, false);
|
||||
myHelpers->WriteByte((INT_PTR)gl_hjgtDll + 0x951156, 0x01, false);
|
||||
}
|
||||
|
||||
UINT8 ff1 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BB9, false);
|
||||
UINT8 ff2 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBA, false);
|
||||
UINT8 ff3 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBB, false);
|
||||
UINT8 ff4 = myHelpers->ReadByte((INT_PTR)gl_hjgtDll + 0x7D2BBC, false);
|
||||
//Change timer back to 0 when test menu & FFB Only while timer above 0
|
||||
if ((timer != 0) || (menuvalue1 == 0x00))
|
||||
{
|
||||
if (menuvalue1 == 0x00)
|
||||
if ((ff2 > 0x00)& (ff2 < 0x40))
|
||||
{
|
||||
myHelpers->WriteFloat32((INT_PTR)gl_hjgtDll + 0x954394, 0, false);
|
||||
double percentForce = (ff2) / 63.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
if ((ff3 != 0x00) && (ff4 != 0x00))
|
||||
if ((ff1 > 0x00)& (ff1 < 0x08))
|
||||
{
|
||||
if ((ff2 > 0x00)& (ff2 < 0x40))
|
||||
{
|
||||
double percentForce = (ff2) / 63.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, percentForce, percentLength);
|
||||
myTriggers->Sine(120, 120, percentForce);
|
||||
}
|
||||
if ((ff1 > 0x00)& (ff1 < 0x08))
|
||||
{
|
||||
//helpers->log("moving wheel left");
|
||||
double percentForce = (ff1) / 7.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff1 > 0x07)& (ff1 < 0x10))
|
||||
{
|
||||
//helpers->log("moving wheel right");
|
||||
double percentForce = (16 - ff1) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
//helpers->log("moving wheel left");
|
||||
double percentForce = (ff1) / 7.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(0, percentForce, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff1 > 0x07)& (ff1 < 0x10))
|
||||
{
|
||||
//helpers->log("moving wheel right");
|
||||
double percentForce = (16 - ff1) / 8.0;
|
||||
double percentLength = 100;
|
||||
myTriggers->Rumble(percentForce, 0, percentLength);
|
||||
myTriggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI RunningLoop(LPVOID lpParam)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
ThreadLoop();
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
|
||||
void RoadFighters3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
|
||||
if (InputDeviceWheelEnable == 1)
|
||||
{
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
if (!init)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
|
||||
//Added 2nd device stuff from here
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
SDL_JoystickClose(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D84B, false);
|
||||
helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x18D84C, false);
|
||||
@ -347,35 +389,6 @@ void RoadFighters3D::FFBLoop(EffectConstants *constants, Helpers *helpers, Effec
|
||||
int gearnumber2 = helpers->ReadIntPtr((INT_PTR)gearnumber1 + 0x390, false);
|
||||
int gearnumber3 = helpers->ReadIntPtr((INT_PTR)gearnumber2 + 0x18, false);
|
||||
|
||||
//Added 2nd device stuff from here
|
||||
wchar_t * deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
SDL_JoystickClose(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (SequentialGears == 1)
|
||||
{
|
||||
helpers->WriteNop((INT_PTR)gl_hjgtDll + 0x95DDA, false);
|
||||
@ -1318,13 +1331,20 @@ void RoadFighters3D::FFBLoop(EffectConstants *constants, Helpers *helpers, Effec
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_Thread *thread;
|
||||
thread = SDL_CreateThread(RunningThread, "RunningThread", (void *)NULL);
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
if (!init)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
CreateThread(NULL, 0, RunningLoop, NULL, 0, NULL);
|
||||
init = true;
|
||||
}
|
||||
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
241
Game Files/Transformers.cpp
Normal file
241
Game Files/Transformers.cpp
Normal file
@ -0,0 +1,241 @@
|
||||
/*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 <string>
|
||||
#include "Transformers.h"
|
||||
#include "SDL.h"
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static bool init = false;
|
||||
static bool Player1Shoot = false;
|
||||
static bool Player2Shoot = false;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
static int HowtoRumbleGunEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleGunEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleRageEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleRageEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename);
|
||||
static int Gun1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun1pStrength"), 0, settingsFilename);
|
||||
static int Rage1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rage1pStrength"), 0, settingsFilename);
|
||||
static int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename);
|
||||
static int Gun2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun2pStrength"), 0, settingsFilename);
|
||||
static int Rage2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Rage2pStrength"), 0, settingsFilename);
|
||||
static int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
void Transformers::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
INT_PTR Base1p = helpers->ReadIntPtr(0x1A3CC1C, true);
|
||||
INT_PTR Base11p = helpers->ReadIntPtr(Base1p + 0x34, false);
|
||||
INT_PTR Base21p = helpers->ReadIntPtr(Base11p + 0x39C, false);
|
||||
UINT8 Health1p = helpers->ReadByte(Base21p + 0x54, false);
|
||||
|
||||
INT_PTR Base12p = helpers->ReadIntPtr(Base1p + 0x20, false);
|
||||
INT_PTR Base22p = helpers->ReadIntPtr(Base12p + 0x398, false);
|
||||
INT_PTR Base32p = helpers->ReadIntPtr(Base22p + 0x1C, false);
|
||||
UINT8 Health2p = helpers->ReadByte(Base32p + 0x310, false);
|
||||
|
||||
UINT8 Gun = helpers->ReadByte(0xD8CE14, false);
|
||||
UINT8 Trigger1p = helpers->ReadByte(0xD8D110, false);
|
||||
UINT8 Trigger2p = helpers->ReadByte(0xD8D112, false);
|
||||
|
||||
static UINT8 oldHealth1p = 0;
|
||||
static UINT8 oldHealth2p = 0;
|
||||
UINT8 newHealth1p = Health1p;
|
||||
UINT8 newHealth2p = Health2p;
|
||||
|
||||
if (!init)
|
||||
{
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
wchar_t* deviceGUIDString2 = new wchar_t[256];
|
||||
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
|
||||
char joystick_guid[256];
|
||||
sprintf(joystick_guid, "%S", deviceGUIDString2);
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
if (i == joystick1Index)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
const char* name = SDL_JoystickName(js2);
|
||||
char text[256];
|
||||
sprintf(text, "Joystick: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||
guid = SDL_JoystickGetGUIDFromString(joystick_guid);
|
||||
dev_guid = SDL_JoystickGetGUID(js2);
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
SDL_JoystickClose(js2);
|
||||
}
|
||||
haptic2 = ControllerHaptic2;
|
||||
if ((SDL_HapticRumbleSupported(haptic2) == SDL_TRUE))
|
||||
{
|
||||
SDL_HapticRumbleInit;
|
||||
SDL_HapticRumbleInit(ControllerHaptic2);
|
||||
}
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
if (Gun == 0x4B)
|
||||
{
|
||||
Player1Shoot = true;
|
||||
Player2Shoot = true;
|
||||
}
|
||||
else if (Gun == 0x42)
|
||||
{
|
||||
Player1Shoot = true;
|
||||
Player2Shoot = false;
|
||||
}
|
||||
else if (Gun == 0x09)
|
||||
{
|
||||
Player1Shoot = false;
|
||||
Player2Shoot = true;
|
||||
}
|
||||
|
||||
if (Player1Shoot)
|
||||
{
|
||||
if (Trigger1p == 0)
|
||||
{
|
||||
Player1Shoot = false;
|
||||
}
|
||||
|
||||
if ((Gun == 0x3) || (Gun == 0x90) || (Gun == 0x93) || (Gun == 0x02) || (Gun == 0x12))
|
||||
{
|
||||
Player1Shoot = false;
|
||||
}
|
||||
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (Player2Shoot)
|
||||
{
|
||||
if (Trigger2p == 0)
|
||||
{
|
||||
Player2Shoot = false;
|
||||
}
|
||||
|
||||
if ((Gun == 0x3) || (Gun == 0x90) || (Gun == 0x93) || (Gun == 0x02) || (Gun == 0x12))
|
||||
{
|
||||
Player2Shoot = false;
|
||||
}
|
||||
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth1p != newHealth1p)
|
||||
{
|
||||
if (Health1p != 100)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth2p != newHealth2p)
|
||||
{
|
||||
if (Health2p != 100)
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oldHealth1p = newHealth1p;
|
||||
oldHealth2p = newHealth2p;
|
||||
}
|
20
Game Files/Transformers.h
Normal file
20
Game Files/Transformers.h
Normal file
@ -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 Transformers : public Game {
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
***FFB Arcade Plugin***
|
||||
|
||||
Version 1.4
|
||||
Version 1.4a
|
||||
|
||||
Brought to you by Boomslangnz, Ducon2016, Spazzy & pinkimo.
|
||||
|
||||
@ -10,6 +10,20 @@ While best efforts were made to try to resemble the real arcade force feedback,
|
||||
in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4,effects were created entirely from scratch
|
||||
so are not using real force feedback values. Most games use correct ffb values however :)
|
||||
|
||||
***1.4a Changes***
|
||||
|
||||
- Fixed issue where FFB/Rumble would not work sometimes if Device2GUID or Device3GUID were blank on certain games
|
||||
|
||||
- Added support for Motion Outputs on Outrun & Power Drift rather then just the shaker motor, change Cabinet type to try (Beware this may act strange as it's designed for Motion Simulator, not FFB!)
|
||||
|
||||
- Added rumble support for Rambo (up to 2 players)
|
||||
|
||||
- Added rumble support for Transformers: Human Alliance (up to 2 players)
|
||||
|
||||
- Modified how seperate threads work for certain games which removes possibility of high CPU load for them
|
||||
|
||||
- Code cleanup
|
||||
|
||||
***1.4 Changes***
|
||||
|
||||
- Added Rumble support for Aliens Extermination
|
||||
@ -502,6 +516,8 @@ extremely generous.
|
||||
|
||||
-Initial D 8 [dinput8.dll into game exe folder]
|
||||
|
||||
-MAME Outputs [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Machstorm (Rumble only) [xinput1_3.dll into game exe folder]
|
||||
|
||||
-Mario Kart GP DX (Version 1.00 & version 1.10) [dinput8.dll into game exe folder]
|
||||
@ -540,36 +556,14 @@ extremely generous.
|
||||
TURN ON FEEDBACK STEERING IN GAME SETTINGS OR YOU WILL NOT RECIEVE FORCE FEEDBACK!
|
||||
(will ONLY work on either Mame Binary 32 or 64 bit or MameUI64 for Mame version 0.199 or 0.206 [dinput8.dll into any mame 0.199 or mame 0.206 folder]
|
||||
|
||||
-San Francisco Rush [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-San Francisco Rush The Rock [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-San Francisco Rush 2049 [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-San Francisco Rush 2049 SE [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-California Speed [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Cruis'n World [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Cruis'n USA [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Off Road Challenge [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Virtua Racing (SET CABINET TO UPRIGHT) [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-OutRun [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Turbo OutRun [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-OutRunners [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-Power Drift [32bit or 64bit dinput8.dll into MAME folder depending on 32 or 64bit MAME]
|
||||
|
||||
-GTI Club Supermini Festa [dinput8.dll into game exe folder]
|
||||
|
||||
-Road Fighters 3D [dinput8.dll into game exe folder]
|
||||
|
||||
-Transformers: Human Alliance [dinput8.dll into game exe folder]
|
||||
|
||||
-Rambo [opengl32.dll into Teknoparrot folder inside Main Teknoparrot folder]
|
||||
|
||||
-Nascar Racing [dinput8.dll into demul 180428 version folder]
|
||||
|
||||
-Let's Go Island [d3d9.dll into game exe folder]
|
||||
|
Loading…
Reference in New Issue
Block a user