Added Golden Gun Rumble as requested
This commit is contained in:
parent
5cdcc28365
commit
d476bd49f6
@ -276,6 +276,18 @@ HowtoRumbleGunEffect=2
|
||||
HowtoRumbleFlameEffect=1
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[Golden Gun]
|
||||
GameId=41
|
||||
Device2GUID=
|
||||
EnableRumbleDevice2=1
|
||||
ReverseRumbleDevice=0
|
||||
Gun1pStrength=50
|
||||
Health1pStrength=100
|
||||
Gun2pStrength=50
|
||||
Health2pStrength=100
|
||||
HowtoRumbleGunEffect=2
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[Rambo]
|
||||
GameId=37
|
||||
FeedbackLength=100
|
||||
|
@ -21,6 +21,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\AliensExtermination.h" />
|
||||
<ClInclude Include="Game Files\FordRacingOther.h" />
|
||||
<ClInclude Include="Game Files\GoldenGun.h" />
|
||||
<ClInclude Include="Game Files\GRID.h" />
|
||||
<ClInclude Include="Game Files\HOTD4.h" />
|
||||
<ClInclude Include="Game Files\InitialD0.h" />
|
||||
@ -50,6 +51,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game Files\AliensExtermination.cpp" />
|
||||
<ClCompile Include="Game Files\FordRacingOther.cpp" />
|
||||
<ClCompile Include="Game Files\GoldenGun.cpp" />
|
||||
<ClCompile Include="Game Files\GRID.cpp" />
|
||||
<ClCompile Include="Game Files\HOTD4.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD0.cpp" />
|
||||
|
@ -119,6 +119,7 @@
|
||||
<ClCompile Include="Game Files\AliensExtermination.cpp" />
|
||||
<ClCompile Include="Game Files\Rambo.cpp" />
|
||||
<ClCompile Include="Game Files\Transformers.cpp" />
|
||||
<ClCompile Include="Game Files\GoldenGun.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\Daytona3.h">
|
||||
@ -251,6 +252,9 @@
|
||||
<ClInclude Include="Game Files\Transformers.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\GoldenGun.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="DLLWrapper.asm" />
|
||||
|
@ -34,6 +34,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "Game Files/FordRacing.h"
|
||||
#include "Game Files/FordRacingOther.h"
|
||||
#include "Game Files/GRID.h"
|
||||
#include "Game Files/GoldenGun.h"
|
||||
#include "Game Files/InitialD0.h"
|
||||
#include "Game Files/InitialD4.h"
|
||||
#include "Game Files/InitialD4Japan.h"
|
||||
@ -944,6 +945,7 @@ const int RAMBO_ = 37;
|
||||
const int FORD_RACING_OTHER = 38;
|
||||
const int KO_Drive = 39;
|
||||
const int Transformers_ = 40;
|
||||
const int Golden_Gun = 41;
|
||||
|
||||
HINSTANCE Get_hInstance()
|
||||
{
|
||||
@ -1969,6 +1971,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case GRID_:
|
||||
game = new GRID;
|
||||
break;
|
||||
case Golden_Gun:
|
||||
game = new GoldenGun;
|
||||
break;
|
||||
case Transformers_:
|
||||
game = new Transformers;
|
||||
break;
|
||||
|
270
Game Files/GoldenGun.cpp
Normal file
270
Game Files/GoldenGun.cpp
Normal file
@ -0,0 +1,270 @@
|
||||
/*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 "GoldenGun.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 bool init = false;
|
||||
static bool health1pbool = false;
|
||||
static bool health2pbool = 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 GoldenGun::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
INT_PTR Base1p = helpers->ReadIntPtr(0x27034A0, true);
|
||||
INT_PTR Base11p = helpers->ReadIntPtr(Base1p + 0x24, false);
|
||||
INT_PTR Base21p = helpers->ReadIntPtr(Base11p + 0x34, false);
|
||||
UINT8 Health1p = helpers->ReadByte(Base21p + 0x3C, false);
|
||||
UINT8 Ammo1p = helpers->ReadByte(Base21p + 0x6C, false);
|
||||
UINT8 Ingame1p = helpers->ReadByte(Base21p + 0x38, false);
|
||||
UINT8 StartButton1p = helpers->ReadByte(0x478F8C, true);
|
||||
|
||||
INT_PTR Base2p = helpers->ReadIntPtr(0x2703388, true);
|
||||
INT_PTR Base12p = helpers->ReadIntPtr(Base2p + 0x28, false);
|
||||
INT_PTR Base22p = helpers->ReadIntPtr(Base12p + 0x38, false);
|
||||
UINT8 Health2p = helpers->ReadByte(Base22p + 0x3C, false);
|
||||
UINT8 Ammo2p = helpers->ReadByte(Base22p + 0x6C, false);
|
||||
UINT8 Ingame2p = helpers->ReadByte(Base22p + 0x38, false);
|
||||
UINT8 StartButton2p = helpers->ReadByte(0x478F94, true);
|
||||
|
||||
static UINT8 oldHealth1p = 0;
|
||||
static UINT8 oldAmmo1p = 0;
|
||||
static UINT8 oldHealth2p = 0;
|
||||
static UINT8 oldAmmo2p = 0;
|
||||
|
||||
UINT8 newHealth1p = Health1p;
|
||||
UINT8 newAmmo1p = Ammo1p;
|
||||
UINT8 newHealth2p = Health2p;
|
||||
UINT8 newAmmo2p = Ammo2p;
|
||||
|
||||
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 (!health1pbool)
|
||||
{
|
||||
if ((Health1p == 0) && (Ingame1p == 12 || Ingame1p == 14))
|
||||
{
|
||||
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);
|
||||
}
|
||||
health1pbool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Ingame1p == 3)
|
||||
{
|
||||
if (StartButton1p != 0x80)
|
||||
{
|
||||
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);
|
||||
}
|
||||
health1pbool = false;
|
||||
}
|
||||
}
|
||||
|
||||
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 (!health2pbool)
|
||||
{
|
||||
if ((Health2p == 0) && (Ingame2p == 12 || Ingame2p == 14))
|
||||
{
|
||||
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);
|
||||
}
|
||||
health2pbool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Ingame2p == 3)
|
||||
{
|
||||
if (StartButton2p != 0x80)
|
||||
{
|
||||
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 (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oldHealth1p = newHealth1p;
|
||||
oldAmmo1p = newAmmo1p;
|
||||
oldHealth2p = newHealth2p;
|
||||
oldAmmo2p = newAmmo2p;
|
||||
}
|
20
Game Files/GoldenGun.h
Normal file
20
Game Files/GoldenGun.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 GoldenGun : public Game {
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
Loading…
Reference in New Issue
Block a user