Changes for past few weeks
This commit is contained in:
parent
6c45831d9f
commit
e931f1fdd0
@ -116,6 +116,9 @@ Rumble2Strength=100
|
||||
Rumble1Length=200
|
||||
Rumble2Length=200
|
||||
|
||||
[Storm Racer G]
|
||||
GameId=48
|
||||
|
||||
[HOTD4]
|
||||
GameId=4
|
||||
FeedbackLength=100
|
||||
@ -205,7 +208,7 @@ GameId=39
|
||||
PowerMode=0
|
||||
FeedbackLength=500
|
||||
|
||||
[InitialD Zero]
|
||||
[InitialD Zero v131]
|
||||
GameId=32
|
||||
FeedbackLength=80
|
||||
PowerMode=0
|
||||
@ -214,6 +217,15 @@ EnableForceSpringEffect=0
|
||||
ForceSpringStrength=70
|
||||
EscapeKeyExitViaPlugin=0
|
||||
|
||||
[InitialD Zero v211]
|
||||
GameId=49
|
||||
FeedbackLength=80
|
||||
PowerMode=0
|
||||
IDZMode=0
|
||||
EnableForceSpringEffect=0
|
||||
ForceSpringStrength=70
|
||||
EscapeKeyExitViaPlugin=0
|
||||
|
||||
[InitialD 4]
|
||||
GameId=16
|
||||
FeedbackLength=5000
|
||||
|
Binary file not shown.
Binary file not shown.
@ -31,6 +31,7 @@
|
||||
<ClInclude Include="Game Files\H2Overdrive.h" />
|
||||
<ClInclude Include="Game Files\HOTD4.h" />
|
||||
<ClInclude Include="Game Files\InitialD0.h" />
|
||||
<ClInclude Include="Game Files\InitialD0v211.h" />
|
||||
<ClInclude Include="Game Files\KODrive.h" />
|
||||
<ClInclude Include="Game Files\MAMESupermodel.h" />
|
||||
<ClInclude Include="Game Files\OutRun2Real.h" />
|
||||
@ -47,6 +48,7 @@
|
||||
<ClInclude Include="Game Files\RoadFighters3D.h" />
|
||||
<ClInclude Include="Game Files\LGI.h" />
|
||||
<ClInclude Include="Game Files\LGI3D.h" />
|
||||
<ClInclude Include="Game Files\StormRacerG.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<None Include="Config\FFBPlugin.ini">
|
||||
<FileType>Document</FileType>
|
||||
@ -71,6 +73,7 @@
|
||||
<ClCompile Include="Game Files\HOTD4.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD0.cpp" />
|
||||
<ClCompile Include="Game Files\DemulInitialDInputs.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD0v211.cpp" />
|
||||
<ClCompile Include="Game Files\KODrive.cpp" />
|
||||
<ClCompile Include="Game Files\MAMESupermodel.cpp" />
|
||||
<ClCompile Include="Game Files\OutRun2Real.cpp" />
|
||||
@ -99,6 +102,7 @@
|
||||
<ClCompile Include="Game Files\SegaRally3Other.cpp" />
|
||||
<ClCompile Include="Game Files\SnoCross.cpp" />
|
||||
<ClCompile Include="Game Files\SonicSegaAllStarsRacing.cpp" />
|
||||
<ClCompile Include="Game Files\StormRacerG.cpp" />
|
||||
<ClCompile Include="Game Files\TestGame.cpp" />
|
||||
<ClCompile Include="Game Files\Transformers.cpp" />
|
||||
<ClCompile Include="Game Files\WackyRaces.cpp" />
|
||||
|
@ -131,6 +131,8 @@
|
||||
<ClCompile Include="Game Files\DemulFasterThanSpeedInputs.cpp" />
|
||||
<ClCompile Include="Game Files\DemulMaximumSpeedInputs.cpp" />
|
||||
<ClCompile Include="Game Files\DemulNascarInputs.cpp" />
|
||||
<ClCompile Include="Game Files\StormRacerG.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD0v211.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\Daytona3.h">
|
||||
@ -293,6 +295,12 @@
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\StormRacerG.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\InitialD0v211.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="DLLWrapper.asm" />
|
||||
|
10
DllMain.cpp
10
DllMain.cpp
@ -42,6 +42,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "Game Files/GRID.h"
|
||||
#include "Game Files/GoldenGun.h"
|
||||
#include "Game Files/InitialD0.h"
|
||||
#include "Game Files/InitialD0v211.h"
|
||||
#include "Game Files/InitialD4.h"
|
||||
#include "Game Files/InitialD4Japan.h"
|
||||
#include "Game Files/InitialD5.h"
|
||||
@ -63,6 +64,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include "Game Files/PokkenTournament.h"
|
||||
#include "Game Files/MarioKartGPDX1.10.h"
|
||||
#include "Game Files/SonicSegaAllStarsRacing.h"
|
||||
#include "Game Files/StormRacerG.h"
|
||||
#include "Game Files/M2Emulator.h"
|
||||
#include "Game Files/GTIClub3.h"
|
||||
#include "Game Files/Demul.h"
|
||||
@ -999,6 +1001,8 @@ const int Sno_Cross = 44;
|
||||
const int Bat_man = 45;
|
||||
const int R_Tuned = 46;
|
||||
const int SEGA_RALLY_3_Other = 47;
|
||||
const int Storm_Racer_G = 48;
|
||||
const int INITIAL_D_0_211 = 49;
|
||||
|
||||
HINSTANCE Get_hInstance()
|
||||
{
|
||||
@ -2293,6 +2297,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case INITIAL_D_0:
|
||||
game = new InitialD0;
|
||||
break;
|
||||
case INITIAL_D_0_211:
|
||||
game = new InitialD0v211;
|
||||
break;
|
||||
case INITIAL_D_4:
|
||||
game = new InitialD4;
|
||||
break;
|
||||
@ -2320,6 +2327,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
case SEGA_RALLY_3_Other:
|
||||
game = new SegaRally3Other;
|
||||
break;
|
||||
case Storm_Racer_G:
|
||||
game = new StormRacerG;
|
||||
break;
|
||||
case WACKY_RACES:
|
||||
game = new WackyRaces;
|
||||
break;
|
||||
|
152
Game Files/InitialD0v211.cpp
Normal file
152
Game Files/InitialD0v211.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
/*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 "InitialD0v211.h"
|
||||
#include "math.h"
|
||||
|
||||
static UINT8 ff;
|
||||
static UINT8 oldff;
|
||||
static UINT8 newff;
|
||||
static UINT8 ff1;
|
||||
static UINT8 ff2;
|
||||
static UINT8 ff3;
|
||||
|
||||
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
|
||||
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
|
||||
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
|
||||
static int IDZMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("IDZMode"), 0, settingsFilename);
|
||||
|
||||
void InitialD0v211::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
|
||||
{
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
if (IDZMode == 0)
|
||||
{
|
||||
ff = helpers->ReadByte(0x18A720F, true);
|
||||
oldff = 0;
|
||||
newff = ff;
|
||||
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
if (EnableForceSpringEffect == 1)
|
||||
{
|
||||
triggers->Springi(ForceSpringStrength / 100.0);
|
||||
}
|
||||
|
||||
if (oldff != newff)
|
||||
{
|
||||
if ((ff > 0x37) && (ff < 0x80))
|
||||
{
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff > 0x00) && (ff < 0x49))
|
||||
{
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff) / 72.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
oldff = newff;
|
||||
}
|
||||
else
|
||||
{
|
||||
ff1 = helpers->ReadByte(0x18A720C, true);
|
||||
ff2 = helpers->ReadByte(0x18A720D, true);
|
||||
if (IDZMode == 1)
|
||||
{
|
||||
ff3 = helpers->ReadByte(0x18A720E, true);
|
||||
}
|
||||
else if (IDZMode == 2)
|
||||
{
|
||||
ff3 = helpers->ReadByte(0x18A720F, true);
|
||||
}
|
||||
|
||||
if (ff1 == 80)
|
||||
{
|
||||
helpers->log("Spring");
|
||||
triggers->Spring(1.0);
|
||||
}
|
||||
else if (ff1 == 0x85)
|
||||
{
|
||||
if ((ff2 > 0x00) && (ff2 < 0x30))
|
||||
{
|
||||
helpers->log("Sine");
|
||||
double percentForce = ff2 / 47.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
triggers->Sine(40, 0, percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff1 == 0x86)
|
||||
{
|
||||
if ((ff3 > 0x00) && (ff3 < 0x4E))
|
||||
{
|
||||
helpers->log("Spring");
|
||||
double percentForce = ff3 / 77.0;
|
||||
double percentLength = 100;
|
||||
triggers->Spring(percentForce);
|
||||
}
|
||||
}
|
||||
else if (ff1 == 0x84)
|
||||
{
|
||||
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80))
|
||||
{
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = (128 - ff3) / 72.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49))
|
||||
{
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = (ff3 / 72.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
|
||||
{
|
||||
helpers->log("moving wheel right");
|
||||
double percentForce = 1.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if ((ff2 == 0x01) && (ff3 > 0x48))
|
||||
{
|
||||
helpers->log("moving wheel left");
|
||||
double percentForce = 1.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
Game Files/InitialD0v211.h
Normal file
20
Game Files/InitialD0v211.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 InitialD0v211 : public Game {
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
89
Game Files/StormRacerG.cpp
Normal file
89
Game Files/StormRacerG.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include <string>
|
||||
#include "StormRacerG.h"
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
|
||||
static bool init = false;
|
||||
|
||||
static void __cdecl UsbIO_SetSeatShakeImpluse(int a1, int a2, float a3, bool a4)
|
||||
{
|
||||
double percentForce = a1 / 1200.0;
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
return;
|
||||
}
|
||||
|
||||
static bool Hook(void* toHook, void* ourFunct, int len) {
|
||||
if (len < 5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD curProtection;
|
||||
VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection);
|
||||
|
||||
memset(toHook, 0x90, len);
|
||||
|
||||
DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5;
|
||||
|
||||
*(BYTE*)toHook = 0xE9;
|
||||
*(DWORD*)((DWORD)toHook + 1) = relativeAddress;
|
||||
|
||||
DWORD temp;
|
||||
VirtualProtect(toHook, len, curProtection, &temp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static DWORD jmpBackAddy;
|
||||
|
||||
void StormRacerG::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
if (!init)
|
||||
{
|
||||
uintptr_t ImageBaseSRG = (uintptr_t)GetModuleHandle((L"racing.exe"));
|
||||
|
||||
int hookLength = 6;
|
||||
DWORD hookAddress = ImageBaseSRG + 0x12C5DE;
|
||||
|
||||
jmpBackAddy = hookAddress + hookLength;
|
||||
Hook((void*)hookAddress, UsbIO_SetSeatShakeImpluse, hookLength);
|
||||
helpers->WriteNop(ImageBaseSRG + 0x12C5DE + 5, 1, false);
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
UINT8 FFB = helpers->ReadByte(0x46F429C, false);
|
||||
UINT8 Enable = helpers->ReadByte(0x4710214, false);
|
||||
float speedo = helpers->ReadFloat32(0x114A22D8, false);
|
||||
|
||||
if (Enable == 0x01)
|
||||
{
|
||||
if (speedo < 0)
|
||||
{
|
||||
speedo = -speedo;
|
||||
}
|
||||
|
||||
double percentForce = speedo / 320.0;
|
||||
|
||||
//4 == Slipstring
|
||||
|
||||
if (FFB & 0x01)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
|
||||
if (FFB & 0x02)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
|
||||
if (FFB & 0x08)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
}
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
}
|
20
Game Files/StormRacerG.h
Normal file
20
Game Files/StormRacerG.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 StormRacerG : public Game {
|
||||
|
||||
public:
|
||||
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
|
||||
};
|
@ -1 +1 @@
|
||||
v2.0.0.4
|
||||
v2.0.0.5
|
Loading…
Reference in New Issue
Block a user