1
0
mirror of synced 2024-11-24 06:50:11 +01:00

Add GRID Custom and Spring to MKGP

This commit is contained in:
Boomslangnz 2023-03-25 23:14:46 +13:00
parent 3020c0ead4
commit 129bf0d391
11 changed files with 194 additions and 12 deletions

View File

@ -114,12 +114,21 @@ DefaultCentering=15
EnableDamper=0
DamperStrength=100
[GRID]
[GRID Real]
GameId=10
FeedbackLength=80
EnableDamper=0
DamperStrength=100
[GRID Custom]
GameId=71
FeedbackLength=80
EnableDamper=0
DamperStrength=100
SpringStrength=65
GearChangeStrength=50
GearChangeLength=80
[Afterburner Climax]
GameId=15
RumbleStrength=100
@ -465,18 +474,24 @@ GameId=70
FeedbackLength=80
EnableDamper=0
DamperStrength=100
SpringEnable=1
SpringStrength=65
[Mario Kart Arcade GP DX v110 Real]
GameId=69
FeedbackLength=80
EnableDamper=0
DamperStrength=100
SpringEnable=1
SpringStrength=65
[Mario Kart Arcade GP DX v118 Real]
GameId=68
FeedbackLength=80
EnableDamper=0
DamperStrength=100
SpringEnable=1
SpringStrength=65
[Mario Kart Arcade GP DX v100 Custom]
GameId=11

View File

@ -34,7 +34,8 @@
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\GaelcoTuningRace.h" />
<ClInclude Include="Game Files\GoldenGun.h" />
<ClInclude Include="Game Files\GRID.h" />
<ClInclude Include="Game Files\GRIDCustom.h" />
<ClInclude Include="Game Files\GRIDReal.h" />
<ClInclude Include="Game Files\H2Overdrive.h" />
<ClInclude Include="Game Files\HOTD4.h" />
<ClInclude Include="Game Files\InitialD0v131.h" />
@ -94,7 +95,8 @@
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\GaelcoTuningRace.cpp" />
<ClCompile Include="Game Files\GoldenGun.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\GRIDCustom.cpp" />
<ClCompile Include="Game Files\GRIDReal.cpp" />
<ClCompile Include="Game Files\H2Overdrive.cpp" />
<ClCompile Include="Game Files\HOTD4.cpp" />
<ClCompile Include="Game Files\InitialD0v131.cpp" />

View File

@ -151,10 +151,11 @@
<ClCompile Include="Game Files\TokyoCop.cpp" />
<ClCompile Include="Game Files\RingRiders.cpp" />
<ClCompile Include="Game Files\InitialD0v230.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\GRIDReal.cpp" />
<ClCompile Include="Game Files\MarioKartGPDX1.18Real.cpp" />
<ClCompile Include="Game Files\MarioKartGPDX1.10Real.cpp" />
<ClCompile Include="Game Files\MarioKartGPDXUSAReal.cpp" />
<ClCompile Include="Game Files\GRIDCustom.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -371,7 +372,7 @@
<ClInclude Include="Common Files\MinHook.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\GRID.h">
<ClInclude Include="Game Files\GRIDReal.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\MarioKartGPDX1.18Real.h">
@ -383,6 +384,9 @@
<ClInclude Include="Game Files\MarioKartGPDXUSAReal.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\GRIDCustom.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />

View File

@ -46,7 +46,8 @@ 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/GaelcoTuningRace.h"
#include "Game Files/GRID.h"
#include "Game Files/GRIDReal.h"
#include "Game Files/GRIDCustom.h"
#include "Game Files/GoldenGun.h"
#include "Game Files/InitialD0v131.h"
#include "Game Files/InitialD0v211.h"
@ -995,7 +996,7 @@ const int SEGA_RALLY_3 = 6;
const int FORD_RACING = 7;
const int INITIAL_D_6 = 8;
const int WMMT_5 = 9;
const int GRID_ = 10;
const int GRID_Real = 10;
const int MARIO_KART_GPDX_CUSTOM = 11;
const int OUTRUN_2Fake = 12;
const int BG4_JP = 13;
@ -1054,6 +1055,7 @@ const int INITIAL_D_0_230 = 67;
const int MARIO_KART_GPDX_118_REAL = 68;
const int MARIO_KART_GPDX_110_REAL = 69;
const int MARIO_KART_GPDX_USA_REAL = 70;
const int GRID_Custom = 71;
HINSTANCE Get_hInstance()
{
@ -2378,8 +2380,8 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case FORD_RACING_OTHER:
game = new FordRacingOther;
break;
case GRID_:
game = new GRID;
case GRID_Real:
game = new GRIDReal;
break;
case Golden_Gun:
game = new GoldenGun;
@ -2555,6 +2557,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case MARIO_KART_GPDX_USA_REAL:
game = new MarioKartGPDXUSAReal;
break;
case GRID_Custom:
game = new GRIDCustom;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

115
Game Files/GRIDCustom.cpp Normal file
View File

@ -0,0 +1,115 @@
/*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 "GRIDCustom.h"
#include "SDL.h"
static EffectTriggers* myTriggers;
static EffectConstants* myConstants;
static Helpers* myHelpers;
static bool gearshift = false;
extern int EnableDamper;
extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename);
static int GearChangeStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeStrength"), 20, settingsFilename);
static int GearChangeLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("GearChangeLength"), 200, settingsFilename);
void GRIDCustom::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
INT_PTR WallBase = helpers->ReadIntPtr(0xB1B7F0, true);
INT_PTR WallBase1 = helpers->ReadIntPtr(WallBase + 0x730, false);
INT_PTR WallBase2 = helpers->ReadIntPtr(WallBase1 + 0x4, false);
INT_PTR WallBase3 = helpers->ReadIntPtr(WallBase2 + 0x4, false);
float WallBase4 = helpers->ReadFloat32(WallBase3 + 0x118, false);
INT_PTR PanelBase = helpers->ReadIntPtr(0xA3FA34, true);
INT_PTR PanelBase1 = helpers->ReadIntPtr(PanelBase + 0x678, false);
INT_PTR PanelBase2 = helpers->ReadIntPtr(PanelBase1 + 0x14, false);
INT_PTR PanelBase3 = helpers->ReadIntPtr(PanelBase2 + 0x30, false);
UINT8 PanelBase4 = helpers->ReadByte(PanelBase3 + 0x2C, false);
UINT8 Wheels = helpers->ReadByte(PanelBase3 + 0xB4, false);
UINT8 Skids = helpers->ReadByte(PanelBase3 + 0x100, false);
UINT8 AI = helpers->ReadByte(PanelBase3 + 0x3D4, false);
UINT8 gear = helpers->ReadByte(0x414F7898, false);
INT_PTR speedoBase = helpers->ReadIntPtr(0x28C008, true);
INT_PTR speedoBase1 = helpers->ReadIntPtr(speedoBase + 0xD0, false);
INT_PTR speedoBase2 = helpers->ReadIntPtr(speedoBase1 + 0x460, false);
INT_PTR speedoBase3 = helpers->ReadIntPtr(speedoBase2 + 0x184, false);
float speedo = helpers->ReadFloat32(speedoBase3 + 0x4F4, false);
UINT8 static oldgear = 0;
UINT8 newgear = gear;
triggers->Springi(SpringStrength / 100.0);
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0);
}
if ((oldgear != newgear) && (speedo > 0))
{
gearshift = true;
}
if (gearshift)
{
myHelpers->log("gear change");
double percentForce = GearChangeStrength / 100.0;
myTriggers->Sine(GearChangeLength, 0, percentForce);
myTriggers->Rumble(0, percentForce, 150);
gearshift = false;
}
if (Wheels > 0)
{
double percentForce = Wheels / 37.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(80, 80, percentForce);
}
if ((Skids > 12) && (speedo > 0))
{
double percentForce = ((Skids - 12) / 8.0);
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
}
if ((AI > 0) && (PanelBase4 > 0))
{
double percentForce = (PanelBase4) / 8.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
}
if ((WallBase4 > 0) && (PanelBase4 > 0))
{
double percentForce = (PanelBase4) / 8.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if ((WallBase4 < 0) && (PanelBase4 > 0))
{
double percentForce = (PanelBase4) / 8.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
oldgear = newgear;
myTriggers = triggers;
myConstants = constants;
myHelpers = helpers;
}

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

View File

@ -12,7 +12,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
*/
#include <string>
#include "GRID.h"
#include "GRIDReal.h"
#include "SDL.h"
static EffectTriggers* myTriggers;
@ -65,7 +65,7 @@ static int __fastcall EnableFFBHook(int a1, double a2)
return 0;
}
void GRID::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
void GRIDReal::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!init)
{
init = true;

View File

@ -14,7 +14,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#pragma once
#include "../Common Files/Game.h"
class GRID : public Game {
class GRIDReal : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};

View File

@ -17,11 +17,18 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper;
extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringEnable"), 0, settingsFilename);
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename);
void MarioKartGPDX110Real::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (SpringEnable)
triggers->Springi(SpringStrength / 100.0);
DWORD Base = helpers->ReadInt32(0xA2FE20, true);
DWORD BaseOff0 = helpers->ReadInt32(Base + 0x08, false);
float FFB = helpers->ReadFloat32(BaseOff0 + 0xA44, false);

View File

@ -17,11 +17,18 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper;
extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringEnable"), 0, settingsFilename);
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename);
void MarioKartGPDX118Real::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (SpringEnable)
triggers->Springi(SpringStrength / 100.0);
DWORD Base = helpers->ReadInt32(0xAAEEA0, true);
DWORD BaseOff0 = helpers->ReadInt32(Base + 0x08, false);
float FFB = helpers->ReadFloat32(BaseOff0 + 0xBC8, false);

View File

@ -17,11 +17,18 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
extern int EnableDamper;
extern int DamperStrength;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int SpringEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringEnable"), 0, settingsFilename);
static int SpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SpringStrength"), 0, settingsFilename);
void MarioKartGPDXUSAReal::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (EnableDamper)
triggers->Damper(DamperStrength / 100.0);
if (SpringEnable)
triggers->Springi(SpringStrength / 100.0);
DWORD Base = helpers->ReadInt32(0xB47B48, true);
DWORD BaseOff0 = helpers->ReadInt32(Base + 0x08, false);
float FFB = helpers->ReadFloat32(BaseOff0 + 0x2FC, false);