Added Aliens Extermination
This commit is contained in:
parent
b38dc7d04c
commit
02ad26b577
@ -246,6 +246,23 @@ GameId=13
|
||||
DefaultCentering=25
|
||||
FeedbackLength=500
|
||||
|
||||
[Aliens Extermination]
|
||||
GameId=36
|
||||
EscapeKeyExitViaPlugin=1
|
||||
FeedbackLength=100
|
||||
Device2GUID=
|
||||
EnableRumbleDevice2=1
|
||||
ReverseRumbleDevice=0
|
||||
Gun1pStrength=50
|
||||
Flame1pStrength=60
|
||||
Health1pStrength=100
|
||||
Gun2pStrength=50
|
||||
Flame2pStrength=60
|
||||
Health2pStrength=100
|
||||
HowtoRumbleGunEffect=0
|
||||
HowtoRumbleFlameEffect=0
|
||||
HowtoRumbleHealthEffect=0
|
||||
|
||||
[MAME 32bit Outputs]
|
||||
GameId=22
|
||||
SinePeriod=100
|
||||
|
@ -19,6 +19,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\AliensExtermination.h" />
|
||||
<ClInclude Include="Game Files\FordRacingOther.h" />
|
||||
<ClInclude Include="Game Files\GRID.h" />
|
||||
<ClInclude Include="Game Files\HOTD4.h" />
|
||||
@ -46,6 +47,7 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game Files\AliensExtermination.cpp" />
|
||||
<ClCompile Include="Game Files\FordRacingOther.cpp" />
|
||||
<ClCompile Include="Game Files\GRID.cpp" />
|
||||
<ClCompile Include="Game Files\HOTD4.cpp" />
|
||||
|
@ -116,6 +116,7 @@
|
||||
<ClCompile Include="Game Files\InitialD0.cpp" />
|
||||
<ClCompile Include="Game Files\OldMame.cpp" />
|
||||
<ClCompile Include="Game Files\OutputReading.cpp" />
|
||||
<ClCompile Include="Game Files\AliensExtermination.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\Daytona3.h">
|
||||
@ -239,6 +240,9 @@
|
||||
<ClInclude Include="Game Files\OutputReading.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\AliensExtermination.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="DLLWrapper.asm" />
|
||||
|
@ -28,6 +28,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
// include all game header files here.
|
||||
#include "Game Files/TestGame.h"
|
||||
#include "Game Files/AliensExtermination.h"
|
||||
#include "Game Files/ChaseHQ2.h"
|
||||
#include "Game Files/Daytona3.h"
|
||||
#include "Game Files/FordRacing.h"
|
||||
@ -936,6 +937,7 @@ const int INITIAL_D_0 = 32;
|
||||
const int OLDMAME_ = 33;
|
||||
const int SUPERMODEL_READING = 34;
|
||||
const int OUTRUN_2Real = 35;
|
||||
const int ALIENS_EXTERMINATION = 36;
|
||||
const int FORD_RACING_OTHER = 38;
|
||||
const int KO_Drive = 39;
|
||||
|
||||
@ -2026,6 +2028,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case Demul_Emulator:
|
||||
game = new Demul;
|
||||
break;
|
||||
case ALIENS_EXTERMINATION:
|
||||
game = new AliensExtermination;
|
||||
break;
|
||||
case GTI_Club_3:
|
||||
game = new GTIClub3;
|
||||
break;
|
||||
|
421
Game Files/AliensExtermination.cpp
Normal file
421
Game Files/AliensExtermination.cpp
Normal file
@ -0,0 +1,421 @@
|
||||
/*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 "AliensExtermination.h"
|
||||
#include "SDL.h"
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
||||
static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
|
||||
static int HowtoRumbleGunEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleGunEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleFlameEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleFlameEffect"), 0, settingsFilename);
|
||||
static int HowtoRumbleHealthEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("HowtoRumbleHealthEffect"), 0, settingsFilename);
|
||||
static int Gun1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun1pStrength"), 0, settingsFilename);
|
||||
static int Flame1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Flame1pStrength"), 0, settingsFilename);
|
||||
static int Health1pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health1pStrength"), 0, settingsFilename);
|
||||
static int Gun2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Gun2pStrength"), 0, settingsFilename);
|
||||
static int Flame2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Flame2pStrength"), 0, settingsFilename);
|
||||
static int Health2pStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("Health2pStrength"), 0, settingsFilename);
|
||||
|
||||
static bool Ammo1pBool = false;
|
||||
static bool Ammo2pBool = false;
|
||||
static bool Flame1pBool = false;
|
||||
static bool Flame2pBool = false;
|
||||
static bool Health1pBool = false;
|
||||
static bool Health2pBool = false;
|
||||
|
||||
void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
UINT8 Ammo1pA = helpers->ReadByte(0x4E7AEA0, true);
|
||||
UINT8 Ammo1pB = helpers->ReadByte(0x4E7AEA1, true);
|
||||
float Flame1p = helpers->ReadFloat32(0x556CB30, true);
|
||||
float Health1p = helpers->ReadFloat32(0x556C884, true);
|
||||
UINT8 Ammo2pA = helpers->ReadByte(0x4E7AEA2, true);
|
||||
UINT8 Ammo2pB = helpers->ReadByte(0x4E7AEA3, true);
|
||||
float Flame2p = helpers->ReadFloat32(0x556CEC4, true);
|
||||
float Health2p = helpers->ReadFloat32(0x556CC18, true);
|
||||
UINT8 Shoot1p = helpers->ReadByte(0x4E7AEC8, true);
|
||||
UINT8 Shoot2p = helpers->ReadByte(0x4E7AF00, true);
|
||||
|
||||
HWND hWnd = FindWindowA(0, ("GLUT"));
|
||||
|
||||
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
|
||||
{
|
||||
if (hWnd > NULL)
|
||||
{
|
||||
TerminateProcess(GetCurrentProcess(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 oldAmmo = 0;
|
||||
UINT8 newAmmo = Ammo1pA;
|
||||
|
||||
static UINT8 oldAmmo2 = 0;
|
||||
UINT8 newAmmo2 = Ammo2pA;
|
||||
|
||||
static float oldFlame = 0;
|
||||
float newFlame = Flame1p;
|
||||
|
||||
static float oldFlame2 = 0;
|
||||
float newFlame2 = Flame2p;
|
||||
|
||||
static float oldHealth = 0;
|
||||
float newHealth = Health1p;
|
||||
|
||||
static float oldHealth2 = 0;
|
||||
float newHealth2 = Health2p;
|
||||
|
||||
static UINT8 oldShoot = 0;
|
||||
UINT8 newShoot = Shoot1p;
|
||||
|
||||
static UINT8 oldShoot2 = 0;
|
||||
UINT8 newShoot2 = Shoot2p;
|
||||
|
||||
if (oldAmmo != newAmmo)
|
||||
{
|
||||
if (Ammo1pBool)
|
||||
{
|
||||
if ((Ammo1pB >= 0) && (Ammo1pA > 0))
|
||||
{
|
||||
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 ((Ammo1pA == 0) && (Ammo1pB == 0))
|
||||
{
|
||||
Ammo1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ammo1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldShoot != newShoot)
|
||||
{
|
||||
if (!Ammo1pBool)
|
||||
{
|
||||
if (Shoot1p == 1)
|
||||
{
|
||||
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 (oldAmmo2 != newAmmo2)
|
||||
{
|
||||
if (Ammo2pBool)
|
||||
{
|
||||
if ((Ammo2pB >= 0) && (Ammo2pA > 0))
|
||||
{
|
||||
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 ((Ammo2pA == 0) && (Ammo2pB == 0))
|
||||
{
|
||||
Ammo2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ammo2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldShoot2 != newShoot2)
|
||||
{
|
||||
if (!Ammo2pBool)
|
||||
{
|
||||
if (Shoot2p == 1)
|
||||
{
|
||||
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 (oldFlame != newFlame)
|
||||
{
|
||||
if (Flame1pBool)
|
||||
{
|
||||
if (Flame1p > 0)
|
||||
{
|
||||
if (HowtoRumbleFlameEffect == 0)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 1)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 2)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Flame1p <= 0) )
|
||||
{
|
||||
Flame1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Flame1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldFlame2 != newFlame2)
|
||||
{
|
||||
if (Flame2pBool)
|
||||
{
|
||||
if (Flame2p > 0)
|
||||
{
|
||||
if (HowtoRumbleFlameEffect == 0)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 1)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 2)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Flame2p <= 0))
|
||||
{
|
||||
Flame2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Flame2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth != newHealth)
|
||||
{
|
||||
if (Health1pBool)
|
||||
{
|
||||
if (Health1p > 0)
|
||||
{
|
||||
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 ((Health1p == 0))
|
||||
{
|
||||
Health1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Health1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth2 != newHealth2)
|
||||
{
|
||||
if (Health2pBool)
|
||||
{
|
||||
if (Health2p > 0)
|
||||
{
|
||||
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 ((Health2p == 0))
|
||||
{
|
||||
Health2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Health2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
oldAmmo = newAmmo;
|
||||
oldAmmo2 = newAmmo2;
|
||||
oldFlame = newFlame;
|
||||
oldFlame2 = newFlame2;
|
||||
oldHealth = newHealth;
|
||||
oldHealth2 = newHealth2;
|
||||
oldShoot = newShoot;
|
||||
oldShoot2 = newShoot2;
|
||||
}
|
20
Game Files/AliensExtermination.h
Normal file
20
Game Files/AliensExtermination.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 AliensExtermination : public Game {
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
Loading…
Reference in New Issue
Block a user