1
0
mirror of synced 2024-11-27 16:10:52 +01:00

Added HOTD4

Disabled for now as it has some serious lag for some reason
This commit is contained in:
Aaron M 2019-10-27 09:57:33 +13:00
parent 0bb0fb1656
commit f537531c7f
5 changed files with 211 additions and 1 deletions

View File

@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\HOTD4.h" />
<ClInclude Include="Game Files\KODrive.h" />
<ClInclude Include="Game Files\OutRun2Real.h" />
<ClInclude Include="Game Files\ButtonRumble.h" />
@ -43,6 +44,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\HOTD4.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
<ClCompile Include="Game Files\OutRun2Real.cpp" />
<ClCompile Include="Game Files\ButtonRumble.cpp" />

View File

@ -115,6 +115,7 @@
<Filter>Game Files</Filter>
</ClCompile>
<ClCompile Include="Game Files\Mame0206.cpp" />
<ClCompile Include="Game Files\HOTD4.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -229,6 +230,9 @@
<ClInclude Include="Game Files\Mame0206.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\HOTD4.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />

View File

@ -61,6 +61,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/LGI.h"
#include "Game Files/Mame0206.h"
#include "Game Files/KODrive.h"
#include "Game Files/HOTD4.h"
// typedefs
typedef unsigned char U8;
@ -877,6 +878,7 @@ const int TEST_GAME_RUMBLE = -7;
const int DAYTONA_3 = 1;
const int WACKY_RACES = 2;
const int CHASE_HQ_2 = 3;
const int HOTD_4 = 4;
const int SEGA_RACING_CLASSIC = 5;
const int SEGA_RALLY_3 = 6;
const int FORD_RACING = 7;
@ -1653,7 +1655,7 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
{
hlp.log("In FFBLoop");
if (configGameId == 15 || configGameId == 16 || configGameId == 23 || configGameId == 24) //Lindbergh Games which require Sleep until loaded enough
if (configGameId == 4 || configGameId == 12 || configGameId == 15 || configGameId == 16 || configGameId == 23 || configGameId == 24 ||configGameId == 35) //Lindbergh Games which require Sleep until loaded enough
{
Sleep(2500);
}
@ -1800,6 +1802,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case KO_Drive:
game = new KODrive;
break;
case HOTD_4:
game = new HOTD4;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

179
Game Files/HOTD4.cpp Normal file
View File

@ -0,0 +1,179 @@
/*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 "HOTD4.h"
#include "SDL.h"
#include <Windows.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 int RunningThread(void *ptr)
{
int cnt;
for (cnt = 0; cnt >= 0; ++cnt)
{
INT_PTR Base = myHelpers->ReadIntPtr(0x1CCEC0, true);
INT_PTR Base1 = myHelpers->ReadIntPtr(Base + 0xF8, false);
INT_PTR Base2 = myHelpers->ReadIntPtr(Base1 + 0x38, false);
INT_PTR Base3 = myHelpers->ReadIntPtr(Base2 + 0x20, false);
UINT8 Health = myHelpers->ReadByte(Base3 + 0x3C, false);
UINT8 Bullet = myHelpers->ReadByte(Base3 + 0x274, false);
UINT8 Grenade = myHelpers->ReadByte(Base3 + 0x2A0, false);
UINT8 static oldHealth = 0;
UINT8 static oldBullet = 0;
UINT8 static oldGrenade = 0;
UINT8 newHealth = Health;
UINT8 newBullet = Bullet;
UINT8 newGrenade = Grenade;
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
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 (oldHealth != newHealth)
{
if (HowtoRumbleHealthEffect == 0)
{
double percentForce = ((Health1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, percentForce, percentLength);
}
else if (HowtoRumbleHealthEffect == 1)
{
double percentForce = ((Health1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(0, percentForce, percentLength);
}
else if (HowtoRumbleHealthEffect == 2)
{
double percentForce = ((Health1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, 0, percentLength);
}
}
if (oldBullet != newBullet)
{
if (HowtoRumbleBulletEffect == 0)
{
double percentForce = ((Bullet1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, percentForce, percentLength);
}
else if (HowtoRumbleBulletEffect == 1)
{
double percentForce = ((Bullet1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(0, percentForce, percentLength);
}
else if (HowtoRumbleBulletEffect == 2)
{
double percentForce = ((Bullet1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, 0, percentLength);
}
}
if (oldGrenade != newGrenade)
{
if (HowtoRumbleGrenadeEffect == 0)
{
double percentForce = ((Grenade1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, percentForce, percentLength);
}
else if (HowtoRumbleGrenadeEffect == 1)
{
double percentForce = ((Grenade1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(0, percentForce, percentLength);
}
else if (HowtoRumbleGrenadeEffect == 2)
{
double percentForce = ((Grenade1pStrength) / 100.0);
double percentLength = (400);
myTriggers->LeftRight(percentForce, 0, percentLength);
}
}
oldHealth = newHealth;
oldBullet = newBullet;
oldGrenade = newGrenade;
}
return 0;
}
void HOTD4::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++)
{
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
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);
}
}
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
}

20
Game Files/HOTD4.h Normal file
View 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 HOTD4 : public Game {
public:
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
};