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

Added KO Drive

This commit is contained in:
Aaron M 2019-09-14 12:29:00 +12:00
parent 81dc22d60d
commit 562c9d17a1
7 changed files with 101 additions and 11 deletions

View File

@ -128,6 +128,11 @@ GameId=6
FeedbackLength=30000
DefaultCentering=15
[KODrive]
GameId=39
FFBMode=0
FeedbackLength=500
[InitialD4]
GameId=16
FeedbackLength=600

View File

@ -22,6 +22,7 @@
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\ButtonRumble64bit.h" />
<ClInclude Include="Game Files\GRID.h" />
<ClInclude Include="Game Files\KODrive.h" />
<ClInclude Include="Game Files\OutRun2Real.h" />
<ClInclude Include="Game Files\Mame019964bit.h" />
<ClInclude Include="Game Files\Mame020664bit.h" />
@ -47,6 +48,7 @@
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
<ClCompile Include="Game Files\OutRun2Real.cpp" />
<ClCompile Include="Game Files\Mame019964bit.cpp" />
<ClCompile Include="Game Files\Mame020664bit.cpp" />

View File

@ -120,6 +120,7 @@
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -246,6 +247,9 @@
<ClInclude Include="Game Files\FordRacingOther.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\KODrive.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="Includes\FFBPlugin.txt" />

View File

@ -52,6 +52,7 @@
#include "Game Files/LGI.h"
#include "Game Files/Mame020632bit.h"
#include "Game Files/Mame020664bit.h"
#include "Game Files/KODrive.h"
// typedefs
typedef unsigned char U8;
@ -917,6 +918,7 @@ const int OUTRUN_2Real = 35;
const int Button_Rumble64bit = 36;
const int GRID_ = 37;
const int FORD_RACING_OTHER = 38;
const int KO_Drive = 39;
HINSTANCE Get_hInstance()
{
@ -1081,7 +1083,7 @@ void TriggerConstantEffect(int direction, double strength)
{
if (AlternativeFFB == 1)
{
/*std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
@ -1091,7 +1093,7 @@ void TriggerConstantEffect(int direction, double strength)
return; // same effect, do nothing.
}
TODO: investigate if we need this
// TODO: investigate if we need this
if (configResetFeedback || strength <= 0.001) {
SDL_HapticStopEffect(haptic, effects.effect_left_id);
SDL_HapticStopEffect(haptic, effects.effect_right_id);
@ -1100,7 +1102,7 @@ void TriggerConstantEffect(int direction, double strength)
lastConstantEffectHash = effectHash;
return;
}
}*/
}
SDL_HapticEffect tempEffect;
SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
tempEffect.type = SDL_HAPTIC_CONSTANT;
@ -1133,12 +1135,12 @@ void TriggerConstantEffect(int direction, double strength)
SDL_HapticUpdateEffect(haptic, effects.effect_right_id, &tempEffect);
SDL_HapticRunEffect(haptic, effects.effect_right_id, 1);
}
/*timeOfLastConstantEffect = now;
lastConstantEffectHash = effectHash;*/
timeOfLastConstantEffect = now;
lastConstantEffectHash = effectHash;
}
else
{
/*std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
std::chrono::milliseconds now = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
long long elapsedTime = (std::chrono::duration_cast<std::chrono::milliseconds>(now - timeOfLastConstantEffect)).count();
int effectId = direction == effectConst.DIRECTION_FROM_LEFT ? effects.effect_right_id : effects.effect_left_id;
std::string effectHash = std::to_string(effectId) + "_" + std::to_string(strength) + "_" + std::to_string(direction);
@ -1157,7 +1159,7 @@ void TriggerConstantEffect(int direction, double strength)
lastConstantEffectHash = effectHash;
return;
}
}*/
}
SDL_HapticEffect tempEffect;
@ -1177,8 +1179,8 @@ void TriggerConstantEffect(int direction, double strength)
SDL_HapticUpdateEffect(haptic, effects.effect_id, &tempEffect);
SDL_HapticRunEffect(haptic, effects.effect_id, 1);
/*timeOfLastConstantEffect = now;
lastConstantEffectHash = effectHash;*/
timeOfLastConstantEffect = now;
lastConstantEffectHash = effectHash;
}
}
@ -1731,6 +1733,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case MAME_020664bit:
game = new Mame020664bit;
break;
case KO_Drive:
game = new KODrive;
break;
case TEST_GAME_CONST:
case TEST_GAME_FRICTION:
case TEST_GAME_SINE:

59
Game Files/KODrive.cpp Normal file
View File

@ -0,0 +1,59 @@
#include <string>
#include "KODrive.h"
void KODrive::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) {
UINT8 ff = helpers->ReadByte(0x00B261F6, /* isRelativeOffset */ false);
UINT8 ff1 = helpers->ReadByte(0x00B261F5, /* isRelativeOffset */ false);
wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
int FFBMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBMode"), 0, settingsFilename);
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char *)ffs.c_str());
if ((ff == 10) & (ff1 == 30))
{
double percentForce = 0.4;
double percentForce1 = 2.7;
double percentLength = 100;
triggers->LeftRight(percentForce1, percentForce1, percentLength);
triggers->Sine(80, 80, percentForce);
}
if (FFBMode == 1)
{
if ((ff > 0x66) & (ff < 0x80) & (ff1 == 0))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 24.0;
double percentLength = 100;
triggers->LeftRight(pow(percentForce, 0.5), 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, (pow(percentForce, 0.5)));
}
else if ((ff > 0x00) & (ff < 0x19) & (ff1 == 1))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 24.0;
double percentLength = 100;
triggers->LeftRight(0, pow(percentForce, 0.5), percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, (pow(percentForce, 0.5)));
}
}
else
{
if ((ff > 0x66) & (ff < 0x80) & (ff1 == 0))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 24.0;
double percentLength = 100;
triggers->LeftRight(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff > 0x00) & (ff < 0x19) & (ff1 == 1))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 24.0;
double percentLength = 100;
triggers->LeftRight(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
}

7
Game Files/KODrive.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
#include "../Common Files/Game.h"
class KODrive : public Game {
public:
void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers);
};

View File

@ -1,6 +1,6 @@
***FFB Arcade Plugin***
Version 1.0
Version 0.9c
Created by Boomslangnz, Ducon2016 & Spazzy.
@ -10,12 +10,18 @@ While best efforts were made to try to resemble the real arcade force feedback,
in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4,effects were created entirely from scratch
so are not using real force feedback values. Most games use correct ffb values however :)
***1.0 Changes***
***0.9c Changes***
- Added FFB Support for KO Drive
***0.9b Changes***
- Fixed issue where M2 Emulator wouldn't close correctly while using FFB Plugin
- Added FFB support for Ford Racing to non-TP loaders (use FordRacingOther plugin)
- Fixed wrong SDL2.dll file with WMMT5 on last release (sorry)
***0.9a Changes***
- Fixed issue where MAME plugins would not load
@ -320,6 +326,8 @@ TURN ON FEEDBACK STEERING IN GAME SETTINGS OR YOU WILL NOT RECIEVE FORCE FEEDBAC
-Let's Go Island 3D [d3d9.dll into game exe folder]
-KO Drive [d3d9.dll into game exe folder]
***HOW TO USE***